Reputation: 1536
I'm using Continuous Intergration with PHPCI and stepped off using multiple branches. Currently we're happy with using simply the master branch to commit (and directly build) all changes.
When another programmer pushes something, and I have to commit my things, usually the following happens:
git commit -a -m 'fixed some stuff'
git pull origin master # -- this creates a merge, even when there's no conflicts
git push origin master
This then creates 2 new commits. One of those is completely useless, as it simply restates what the other developer already did! This slows down the CI and is very annoying. I'm fine if there's a commit on a conflict (although there's no real reason to build it separately), but I think there must be a way around these empty merges.. the files didn't actually change aside from the new stuff that was committed.
Anyone know if there's another way to merge that will not create a merge commit?
Upvotes: 1
Views: 1072
Reputation: 84343
To avoid merge commits, you need to enforce fast-forwards whenever possible. Both git-merge and git-pull support the --ff-only
flag. The man pages say:
--ff-only
Refuse to merge and exit with a non-zero status unless the current
HEAD is already up-to-date or the merge can be resolved as a
fast-forward.
This flag should help you cleanly merge commits without conflicts that can be resolved as fast-forwards, while still allowing you to handle conflicts in the usual ways.
Upvotes: 5