Day 10 Advance Git & GitHub for DevOps Engineers.

Day 10 Advance Git & GitHub for DevOps Engineers.

Day 10 of #90daysofdevops

Hey Techies! Welcome to this blog

In this blog, we are going to Advance in Git and GitHub for DevOps engineers.

What is Git Branching?

Branching means diverging from the mainline and continuing to work separately without messing with the mainline. 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 (more on this later).

Git Revert and Reset?

Git Revert and reset are two important commands in the Git version control system that allow developers to undo changes in their repository.

Git Revert

  • Using git revert, you can go back to previous states while creating a new commit.

  • Go for this option if you want to undo changes on a public branch, for safety.

Git Reset

  • With git reset, you can go back to the previous commits, but can’t create a new commit.

  • This option is better when undoing changes on a private branch.

What is Git Rebase and Merge?

Git Merge

The easiest option to merge the branches is using the git merge command. Git merge safeguards the histories of both repositories. You can use the following merge command to merge your branch. Move to your main directory and then write these commands:

git checkout feature
git merge main

Git Rebase

The alternative to git merge is the git rebase option. In this, we rebase the entire feature branch to merge it with the main branch. Follow the following commands to perform the merge commit:-

git rebase main

Thank you so much for taking the time to read till the end! Hope you found this blog informative and helpful.

Feel free to explore more of my content, and don't hesitate to reach out if need any assistance from me or in case of you have any questions.

Happy Learning!

~kritika :)

Connect with me: linkedin.com/in/kritikashaw