Git commands part-3

Default featured post

Previously I wrote two posts about Git commands which first one was the basics and second one intermediate level. This post covers upper intermediate level about Git commands with focus areas on branching and merging. If you still have not gone through the previous posts, I highly recommend to look at them first.
I did my best to keep it simple and short.

Creating and pushing a branch

$ git branch myBranch
$ git checkout myBranch
$ git push

Pulling & merging from another branch

Assuming I am in branch myBranch but I want to pull the changes from “Master” branch. In that case,

$ git checkout myBranch
$ git pull origin master
$ git merge origin master
$ git push

Merging a branch into master branch

Assume I have myBranch and I decided to merge this to “Master” branch.

$ git checkout master
$ git pull origin myBranch
$ git merge origin myBranch
$ git push

Deleting a branch

$ git branch -d myBranch
$ git push