How to merge git commits in the develop branch to a feature branch -
i have develop branch , feature branch in git repo. added commit develop , want commit merged feature branch. if this
git checkout feature git merge develop
i end merge commit. since i'll merging new commits on develop feature branch frequently, i'd avoid these unnecessary merge commits. saw answer suggested doing git rebase develop
ends rewinding branch way far , rebase fails.
update: ended doing was
git checkout feature git merge develop # creates merge commit don't want git rebase # gets rid of merge commit keeps commits develop want git push
update: noticed original commit on develop gets different hash when merge rebase feature branch. don't think that's want because i'll merge feature develop , i'm guessing won't play nice.
to integrate 1 branch another, have either merge or rebase. since it's safe rebase commits aren't referenced anywhere else (not merged other local branches; not pushed remote), it's better merge.
if feature branch purely local, can rebase on top of develop. however, takes time understand how rebase works, , before do, it's quite easy accidentally produce duplicated or dropped commits. merge commits might noisy merging guaranteed safe , predictable.
for better view, try logging in graph:
git log --all --graph --oneline --decorate
it's worth considering whether need commits on develop
merged feature
. they're things can left seperate until feature
merged develop
later.
if regularly find need develop
code on feature
might sign feature branches long-running. ideally features should split in such way can worked on independently, without needing regular integration along way.
Comments
Post a Comment