git - How to avoid merge-commit hell on GitHub/BitBucket -
we're ending lot of commits in our repo:
merge branch 'master' of bitbucket.org:user/repo this happens every time developer syncs his/hers local fork top-level repo.
is there anyway avoid merge-commit hell cluttering repo log? can 1 avoid them when initiating pull-requests in way?
i know can git rebase if done in local vm only, there equivalence in github/bitbucket ui?
how guys it?
rebase feature branches before merging
if want avoid merge commits, need ensure commits fast-forwards. making sure feature branch rebases cleanly onto line of development before merge so:
git checkout master git checkout -b feature/foo # make commits git rebase master git checkout master git merge --ff-only feature/foo rebase has lot of flags, including interactive rebasing -i flag, may not need if you're keeping things simple possible , want preserve of branch history on merge.
use --ff-only flag
aside rebasing, use of --ff-only flag ensure fast-forward commits allowed. commit not made if merge commit instead. git-merge(1) manual page says:
--ff-only
refuse merge , exit non-zero status unless current head up-to-date or merge can resolved fast-forward.
Comments
Post a Comment