Wednesday, January 6, 2016

Git Tips: How to delete local branch and remote branch

I found this two commands very handy to keep your local and remote repositories clean from unused branches. Here are the steps that usually I use to keep my repositories clean:
  • First to check branches that exist in your local repository use the following command
$ git branch
  • After you see the list of your branches choose one you want to delete as seen bellow
$ git branch -d <your-branch-name>
  • To check branches that exist in your remote repository use this command
$ git branch -r
  •  And the to delete your remote branch use the following command
$ git push origin :<your-branch-name>
If you find this post useful, please leave a comment. :)

No comments:

Post a Comment

Finally, C# 9 record, the equivalent of Scala's case class

While C# is a wonderful programming language, there is something that I would like to see to make our life programmer easier. If you are fam...