Git Branching
Each repository has one default branch and can have multiple other branches. You can merge a branch into another branch using a pull request.
To show all Branches:
git branch
Create a new Branch:
git branch <branch_name>
Specific or Change of Branch:
git checkout <branch_name>
Delete a Branch:
git branch -d <branch_name>
Git Revert and Reset
Two commonly used tools that git users will encounter are git reset
and git revert
. The benefit of both of these commands is that you can use them to remove or edit changes you’ve made in the code in previous commits.
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.