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

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -