I want to change something to only one commit C:
I can do
git filter-branch --XXXXX-filter 'test $GIT_COMMIT = CHash && do-something' 
-- --all
But it's an useless heavy work: only descendants of C (including C) need to 
be scanned.

The idea is to change C by replacing it (git replace -i C) and re-hash C an 
all its descendants to permanently incorporate changes. 

The better way I found to scan all commits from C *including C* is:
git filter-branch ^C^1 --all --ancestry-path

   1. I don't understand why this command works because --all and 
   --anscetry-path is not documented options of git-filter-branch but 
   git-rev-list's options. (there is no -- in my command line)
   2. Other children of C^ will be scanned
   3. When filter-branch looks for non-related branch, warnings are 
   4. Don't work if C is an initial commit

Another alternative way:
git filter-branch -- $(git branch --contains C | cut -b3-) --not C^@


   1. Tags are not moved to new commits
   2. Don't work if C is an initial commit

Any ideas ?

I'm using git 2.1.1

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 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to