git - Bitbucket - Syncing Branch with another Branch -


this may duplicate of how keep git branch in sync master (i assume can replace master other branch), it's vital works , doesn't merge wrong way around need make sure.

scenario

there branch called v1, , created branch off of called v1_adminui. i've made around 10 commits branch v1_adminui, major improvement part of project has been made in v1, want sync change current branch.

i believe following it:

git checkout v1 git pull git checkout v1_adminui git merge v1 

please can confirm if correct? if not, appreciated on how accomplish this.

since 1 working on branch, should use rebase instead of merge.

# base branch git checkout v1  # pull in changes make sure have latest version git pull  # check out branch git checkout v1_adminui  # rebase changes on top of v1 changes git rebase v1  # optionally push rebased branch git push origin v1_adminui 

you might have use --force option when pushing in last step. since you're rewriting branch's history rebase, remote branch have different history. if no-one else using branch!


Comments