Letter A, logo

Git and branches. Create, merge and delete.

Icon calendar

April 2021

Icon calendar

1 min

Working with git can be overwhelming. Here are some easy commands to make it better while working with branches.

New branch

To create a new branch, run git branch new-branch. This will create a new branch copying the the current branch (all history included).

Merge branch to master

First, we need to go to the master branch as you need to be in the branch you want to merge to. Use git checkout master to change the active branch back to master.

Then git merge new-branch to merge the new branch into the master branch (where you are currently).

Remove branch from local and remote

Local

git branch -d branchNameInLocal

Remote

git push origin --delete branchNameInRemote
Icon tag git Icon tag nugget
Twitter iconTweet me about this!