I'd like to run git filter-branch
on all children of a given commit. This doesn't seem to be an easy task, since there doesn't appear to be a way to tell git rev-list
to only return children of a particular commit. Using the .. syntax won't work because it will also include the parent commits of any merge within that range. Am I missing something here?
edit
To clarify: I've got a branch called base
which has been merged into derivative
multiple times. I'd like to list, and eventually run filter-branch
on, just the commits that descend from its most recent commit. I'd also like to list similar commits on other branches.
The (simplified) situation (derivative
is the branch on the left):
$ git rev-list --graph --oneline base derivative
* f16fd151b374b2aeec8b9247489c518a6347d001 merged in the latest from the base branch
|\
| * 564d795afb63eab4ffe758dbcd726ca8b790f9f6 spelling correction
* | 2f2ed5f1d429492e1491740e30be5a58ec20af21 snogg before flarg
|\ \
| |/
| * 0c520ea33ef57b30846b122781d41fcef5e62f9b now with added flarg
* | 5068c34c3862856f511b6b4d48f2adb766e1bde4 now with added snogg
|/
* b51f227e931f830cbda042bc372087398ae7e50d initial commit
@araqnid's suggestion doesn't seem to work, unless I've botched reading it:
$ git rev-list --oneline derivative --not base
f16fd151b374b2aeec8b9247489c518a6347d001 merged in the latest from the base branch
2f2ed5f1d429492e1491740e30be5a58ec20af21 snogg before flarg
5068c34c3862856f511b6b4d48f2adb766e1bde4 now with added snogg
as this gives all commits in derivative
except for the commits in base
. This kind of makes sense, since all it's doing is removing the ancestors of the negated commit. What I want it to show is just the first line.