Take the 2-minute tour ×

This is a newbie question. I have 2 branches, branch_A and branch_B. I am in branch A and do a merge with this command:

git checkout branch_A
git merge --commit -m "my commit" branch_B

If there is no conflict, it automatically does the merge and updates the branch_A to new commit. But branch_B is still in same place.

How can I update the branch_B to point in same place than branch_A?

share|improve this question
correct command is git merge --commit -m "my commit" branch_B –  CharlesB Apr 24 '12 at 14:31

1 Answer 1

up vote 1 down vote accepted

This is a bit unusual, since most of the time you don't need a branch you've merged. So ask yourself if it is really what you want.

If it is, the simplest solution is to merge branch_B with branch_A. It won't create a merge commit, because it can be fast-forwarded, but it will point to the same place as branch_A. Commands are:

git checkout branch_B
git merge branch_A
share|improve this answer
It sounds like the OP might just be misunderstanding what merge means - it only modifies the branch you're merging into. It means "bring everything from that branch into this one", not "bring these two branches together". –  Jefromi Apr 24 '12 at 14:39
@Jefromi lot, you are a correct. I am doing this things in a bash script to automatize a task. For now, I thought this was good idea. CharlesB answer work great –  Rodrigo Apr 24 '12 at 15:01
@Rodrigo: sorry to insist, but make sure this is what you want, I don't know your workflow but usually merges are to integrate a feature-branch into a master development branch, so you don't need to have both branch point at same point after merge. –  CharlesB Apr 24 '12 at 15:04

Your Answer


