adl.io
beautiful technology
M E N U

What am I About to Merge (with Git) Jul 14 2009

This is one of my own personal Git FAQs. Here’s the scenario: You’ve created a topic branch of new code, and done all the work required to complete the feature. But before you can merge it back into the main tree, you get assigned to some new work, and the branch sits dormant for several days. Now the time has come to merge that feature back in, but it’s been so long, you forgot exactly what the code included. Does it conflict with anything new? Was part of the problem solved with some later code? Here’s how you find out:

    git co development # The destination branch
    git diff HEAD...topic-branch

You’ve probably guessed that the magic there is the dot-dot-dot. That symbol means show the difference between the common ancestor commit and HEAD. in other words, only show what changes in the topic branch while it was distinct from the branch it’s being merged into.