My new git alias — diffmaster

I’m going to admit making some mistakes lately while doing git merges during pull requests. I determined one of my biggest problems was the way diffs are presented in BitBucket. It can make things look very unclear because huge chunks of code will look deleted only to be added back in at later points in bits and pieces. It is hard to realize the nuanced changes usually made in code and can cause headaches down the road. To combat this problem I wrote a quick git alias called diffmaster that will run a diff of the current branch against the master branch. The command I aliased is git difftool master...<branch-to-compare>. I added the following lines to my [alias] section of my .gitconfig.

    branch-name = "!git rev-parse --abbrev-ref HEAD"
    diffmaster = "!git difftool master... $(git branch-name)"

Markus Spiske

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s