Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[january-dev] Squash and Merge vs Create a Merge Commit

Hi devs,

At the moment we are adding to the git history lots of irrelevant commits. Nearly half of the commits are merge commits that just have the effect of making our history messy looking without adding much information.



The only information that merge commits are adding is the PR# and the person who applied the commit. 

The other information the merging adds is, generally, commits in the PR that are incomplete. This means that checking out intermediary commits will not give a working copy of the code. Obviously we don't release those intermediary versions, but doing operations like bisect and blame are made more difficult by this.

All of these issues can be solved with a squash and rebase workflow. GitHub added the ability in August [1] to do this from the GitHub UI. Simply select "Squash and Merge" instead of "Create a Merge Commit"



This will remove intermediary commits (generally those that are being patched by further commits on the same PR) and add the PR# to the end of the commit summary line.

I don't recommend squashing genuine feature branches that have real history (as opposed to fixups). 

Thanks,
Jonah

[1] https://github.com/blog/2141-squash-your-commits


~~~
Jonah Graham
Kichwa Coders Ltd.
www.kichwacoders.com

Back to the top