We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I am doing an interactive rebase, I may want to edit a commit:
pick 1249rya Foo bar edit 1249rya Foo bar pick 1249rya Foo bar
Annoyingly, I need to git undo --soft afterwards to actually edit the commit. (Although git commit --amend is valid too).
git undo --soft
git commit --amend
I later learned I can do:
pick 193472 Foo bar exec git undo --soft
But commit message is lost, when I re-run git commit, COMMIT_EDITMSG is empty.
git commit
COMMIT_EDITMSG
This alias, git redo, combined with a git-hook, can re-populate the commit message:
git redo
[alias] redo = !echo "$(git log -1 --format=%B HEAD)" > $GIT_DIR/LAST_COMMIT_MSG && git undo && git restore --staged $(git diff --name-only --staged --diff-filter=ard) > /dev/null 2>&1 || true && cat $GIT_DIR/LAST_COMMIT_MSG && echo '' && git -c advice.addEmptyPathspec=false add -N $(git ls-files --others --exclude-standard) > /dev/null 2>&1 || true
git hooks are documented here: https://stackoverflow.com/a/73981850/565877
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I am doing an interactive rebase, I may want to edit a commit:
Annoyingly, I need to
git undo --soft
afterwards to actually edit the commit. (Althoughgit commit --amend
is valid too).I later learned I can do:
But commit message is lost, when I re-run
git commit
,COMMIT_EDITMSG
is empty.This alias,
git redo
, combined with a git-hook, can re-populate the commit message:git hooks are documented here: https://stackoverflow.com/a/73981850/565877
The text was updated successfully, but these errors were encountered: