Skip to content
amend any git commit not only last
Branch: master
Clone or download
Pull request Compare This branch is 1 commit ahead of albfan:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
git_reword_editor.bat
git_reword_editor.sh

README.md

git-rebase-reword

git-rebase-reword is a simple git command to change one commit (last or older) the same way as you ammend

Documentation

It is named after the action on rebase interactive to ammend a commit "reword". See this post and git rebase man -section interactive mode- ##Install

Download and symlink to your path

$ git clone https://github.com/albfan/git-rebase-reword.git
$ cd git-rebase-reword

for windows:

  • copy git_reword_editor.bat to your %PATH%
  • make git reword alias :
  git config --global alias.reword "!f() { echo $1;  if [ -z \"$1\" ] ; then echo 'need arg1 !' ;exit 1 ;fi ; export REWORD_COMMIT=$(git rev-parse  --short \"$1\");echo REWORD_COMMIT=$REWORD_COMMIT;export REBASE_COMMIT=$(git rev-parse  --short \"$REWORD_COMMIT~1\"); echo REBASE_COMMIT=$REBASE_COMMIT;export GIT_SEQUENCE_EDITOR='git_reword_editor.bat';git rebase -i $REBASE_COMMIT; }; f"

for linux

  • copy or link git_reword_editor.sh to your $PATH
  • make git reword alias :
  git config --global alias.reword '!f() { echo input=$1; if [ -z "$1" ] ; then echo "need arg1 !" ;exit 1 ;fi ; export REWORD_COMMIT=$(git rev-parse  --short $1 );echo REWORD_COMMIT=$REWORD_COMMIT;export REBASE_COMMIT=$(git rev-parse  --short ${REWORD_COMMIT}~1); echo REBASE_COMMIT=$REBASE_COMMIT;export GIT_SEQUENCE_EDITOR=git_reword_editor.sh;git rebase -i $REBASE_COMMIT; }; f'

##Usage

$ cd <repo>
$ git reword <commit|symbolic-ref>

Examples

# reword a commit
$ git reword b68f560
# reword a reference
$ git reword HEAD^
# reword last commit
$ git reword
You can’t perform that action at this time.