Am Mittwoch, 21. Mai 2014 02:21:42 UTC+2 schrieb Sam Roberts:
> I suspect there is an easy way to do this, because every git commit is 
> an object that references a tree object that contains a complete 
> source tree. I just want to take the tree that is at the head of 
> branch SRC, and make a new commit at the head of branch DST that refs 
> the same tree... but I don't know how to do this. 
> Perhaps the following command sequence works for you 

# determine <tree hash> for HEAD of SRC branch
$ git log -1 --pretty=format:%t SRC 

# create new commit object for SRC tree with current HEAD of DST branch as 
parent, returns <commit hash>
$ git commit-tree -p DST -m '<commit message>'  <tree hash>

# move HEAD of DST branch
$ git update-ref refs/heads/DST <commit hash>

Keep in mind the above sequence does not touch your worktree, i.e. to see 
the result
you have to checkout DST.

Kind regards, Werner.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to