tags:

views:

43

answers:

3

This is my current repo.

Z(master)---A---B---C---D(branch A)
           \
            ---E---F(branch B)

I want to merge commit A to master, can anyone advise how to do that?

(desired)

Z---A(master)---B---C---D(branch A)
     \
      ---E---F(branch B)

EDIT:

The advance of base to branch B from A to B is my typo. Please disregard it. Sorry for the confusing! Even I still learn a trick.

+1  A: 

If Z is the last commit on master, a simple git merge SHA1(A) will fast-forward master HEAD to A.

However, to advance branchB starting from B (I know, it was a typo in your question), you will need to:

git branch tmp SHA(B)
git checkout branchB
git rebase tmp
VonC
+1  A: 

I guess, just like:

git reset master A

BUt only, if the structure is like ths>

<old>---Z<master>A---B---C---D<A>
                      \
                       \
                        \
                         E---F<B>

Afterwards it's like this:

<old>---Z---A<master>B---C---D<A>
                      \
                       \
                        \
                         E---F<B>

Elsewhere, correct your tree please.

FUZxxl
+1  A: 

You use git merge to merge new changes into a branch. So while you have master checked out

$ git checkout master

you simply merge B.

$ git merge B

For B above, simply use the hash of that commit, or name it with A~3 or similar.

This will fast-forward master to include all commits up to B.

dkagedal