Closed ArikDavidov closed 3 years ago
@ArikDavidov Thanks for your contribution and also thanks for letting me known this elegant way to do the fixup! I have always used git rebase
before.
I made some minor changes based on your pr. Please let me known if there is any misunderstanding.
Hi @ArikDavidov
Can you elaborate a bit on what a good test case for this would be? I am trying to implement this in fish, but I haven't used this functionality of git before.
If you can provide me an easy to try test case, it would be super valuable for me!
Thanks
Sure @cjappl .
echo "hell world!" > my_file
git add my_file
git commit -m"First commit"
echo "Some other text" > another_file
git add another_file
git commit -m"Second commit"
# At this point you realize you have a typo in the second to last commit ("First commit")
echo "hello world!" > my_file
git add my_file
gfu
# Select "First commit"
# The expected result is that "First commit" is now fixed and there is no additional new commits
Thank you @ArikDavidov
I think I have mine up to what the zsh version is doing, but when I run your steps I am getting additional new commits that say "fixup! First commit", as you can see in my commit history.
I replicated this on zsh as well, so if it is a bug I think it exists in both zsh and fish versions of forgit right now.
Any idea if this is an issue, and how it could be fixed?
@cjappl It seems renaming "$commit~" -> "$target_commit~" fixes this bug.
Closed with fish #149. Thanks for the help @ArikDavidov
Signed-off-by: Ariel Davidov arik.davidov@gmail.com
Check list
Description
A combination of fixup and autosquash is useful to fix any past commit. However, using it manually is inconvenient (see: https://fle.github.io/git-tip-keep-your-branch-clean-with-fixup-and-autosquash.html). Fixing the last commit is easy:
git commit --amend --no-edit
. The new function makes fixing any commit as convenient as fixing the last commit.Type of change
Test environment