git rebase branch with all subbranches -
is possible rebase branch it's subbranches in git?
i use branches quick/mutable tags mark commits.
* master * * featurea-finished * * origin/master
now want rebase -i
master
onto origin/master
, change/reword commit featurea-finished^
after git rebase -i --onto origin/master origin/master master
, want history be:
* master * * featurea-finished * (changed/reworded) * origin/master
but is:
* master * * (same changeset featurea-finished) * (changed/reworded) | * featurea-finished |.* (original commit wanted edit) * origin/master
is there way around it, or stuck recreating branches on new rebased commits?
according git's object model if change meta-data of commit (i.e. commit message) not underlying data ("tree(s)") contained within it's tree hash remain unchanged.
aside editing commit message, performing rebase, change tree hashes of each commit in history, because changes pulled origin/master
affect files in re-written history: means of files (blobs) commit points have changed.
so there no bullet-proof way want.
that said, editing commit rebase -i
not alter commit's timestamp , author, use uniquely identify commits before , after rebase operation.
you have write script records branch start-points against these "timestamp:author" identifier before doing rebase, , find rewritten commits same "timestamp:author" id , rebase branch on it.
sadly, don't have time try writing script myself now, can wish best of luck!
edit: can obtain author email address , timestamp using:
$ git log --graph --all --pretty=format:"%h %ae:%ci" * 53ca31a robert.meerman@gmail.com:2010-06-16 13:50:12 +0100 * 03dda75 robert.meerman@gmail.com:2010-06-16 13:50:11 +0100 | * a8bb03a robert.meerman@gmail.com:2010-06-16 13:49:46 +0100 | * b93e59d robert.meerman@gmail.com:2010-06-16 13:49:44 +0100 |/ * d4214a2 robert.meerman@gmail.com:2010-06-16 13:49:41 +0100
and can obtain list of branches each of these based on commit hash:
$ git branch --contains 03dda75 * testbranch
watch out multiple branches per commit, common ancestor d4214a2
belongs both branches!
Comments
Post a Comment