Practical Web Programming

Friday, June 05, 2015

Compare Between Branches in Github

Before you deploy or when you make a release note, typically you would compare master with develop branch to get the differences and find out what has changed. In Github, it's so easy to do that. All you have to do it is go to the following link and supply the branches that you want to compare

https://github.com/kabalweg/my_app/compare/[OUTDATED_BRANCH]...[UPDATED_BRANCH]

Example:

git: Delete All Local Branches that Already Merged to Master

After sometime using git and creating branches for every feature or bug, you will end up with a lot of branches. Some has been merged to the master branch and some are not. For those that been merged to master, there is no point for them to be in your local machine, so it's better to delete those so it will not clatter your local repository. To do that you just run the command below in your local repo:

git branch --merged | grep -vE "\*|\develop|\master" | xargs -n 1 git branch -d

This command will delete all local branches that are merged to master except for the current checked out branch, develop and master.

Recent Post