Skip to content

Branching and Merging

Git Branches

git branch (to check branch)
git branch -M main (to rename branch)
git checkout <branch name> (to navigate)
git checkout -b <new branch name> (to create new branch)
git branch -d <branch name> (to delete branch)

Merging Code

Way 1:

git diff <branch name>
git merge <branch name>

Way 2:

create a PR (Pull Request)


Pull Request

it lets you tell others about changes you’ve published to a branch in a repo on GitHub


Resolving Merge Conflicts

An event when git is unable to automatically resolve differences in code between two commits