Day 10 Task: Advance Git & GitHub for DevOps Engineers.

Day 10 Task: Advance Git & GitHub for DevOps Engineers.

Table of contents

Git Branching:

Git branching allows developers to diverge from the production version of code to fix a bug or add a feature. Developers create branches to work with a copy of the code without modifying the existing version. You create branches to isolate your code changes, which you test before merging to the main branch.

Git Revert and Reset:
The git revert command can be considered an 'undo' type command, however, it is not a traditional undo operation. Instead of removing the commit from the project history, it figures out how to invert the changes introduced by the commit and appends a new commit with the resulting inverse content. This prevents Git from losing history, which is important for the integrity of your revision history.

Git Rebase and Merge:

Git Rebase:

Git rebase is a command that lets users integrate changes from one branch to another, and the logs are modified once the action is complete. Git rebase was developed to overcome merging’s shortcomings, specifically regarding logs.

Git Merge:

Git merge is a command that allows developers to merge Git branches while the logs of commits on branches remain intact.

The merge wording can be confusing because we have two methods of merging branches and one of those ways is called “merge,” even though both procedures do essentially the same thing.

Task 1:

Add a text file called version01.txt inside the Devops/Git/ with “This is the first feature of our application” written inside.

switch to dev branch,version01.txt should reflect at the local repo first followed by the Remote repo for review.

Add a new commit in dev branch after adding the below-mentioned content in Devops/Git/version01.txt: While writing the file make sure you write these lines

  • 1st line>> This is the bug fix in the development branch

  • Commit this with the message “ Added feature2 in development branch”

  • 2nd line>> This is gadbad code

  • Commit this with the message “ Added feature3 in the development branch

    • 3rd line>> This feature will gadbad everything from now.

    • Commit with the message “ Added feature4 in the development branch

  • Restore the file to a previous version where the content should be “This is the bug fix in the development branch”

    Task 2:

  • Demonstrate the concept of branches with 2 or more branches with a screenshot.

    Thanks for reading!!!!!