tummychow / git-absorb

git commit --fixup, but automatic
https://crates.io/crates/git-absorb
BSD 3-Clause "New" or "Revised" License
3.38k stars 58 forks source link

Base from last merge commit, rather than a range or --base branch #24

Closed rjmunro closed 2 years ago

rjmunro commented 4 years ago

I don't want to go making fixups before the last merge commit, it will destroy the history. But because my master branch is always the latest feature branch merged in, I am always happy to fixup every commit until the last merge. IMHO this should be the default behaviour.

tummychow commented 4 years ago

i'm not sure i understand your request. consider this commit history:

* a8c6ce71bf99f9eca9e15183836c5fc82a40e675 (HEAD -> add-feature-2) feature 2 commit 2
* 08a4a4152cb6ce576e40ae9614a01aec6e15d38a feature 2 commit 1
*   32371794430a131bc4c690c88ef53b6172b2f6a8 (master) Merge branch 'add-feature-1'
|\
| * 36257a3f996929aa687e4c3488cf518449557f66 feature 1 commit 2
| * 6bd08c4695193cc89a3309ed43e007da8023adaf feature 1 commit 1
|/
* 5222dd18db0c834f58c99749e43c81117aee7677 master 1
* 3b5f4cc8989c7419c8b104e10763494c2ded7d19 init

if you run git-absorb on this commit graph today, it'll choose 3237179 as the base. isn't that the same as what you described? i don't see what would actually be different with your change.

in addition, your change doesn't degrade gracefully for a linear master (eg repositories that use squashes/rebases only). if master has no merge commits, then "always use a merge commit as the base" would not be an acceptable default.