Skip to content

Bash script to amend older commits with staged changes

License

Notifications You must be signed in to change notification settings

lightblu/git-amend-old

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

git-amend-old

Bash script to amend older commits with staged changes.

Think of it like git commit --amend, but for older commits.

Special thanks to @VonC for this StackOverflow answer which provided the basis for this script.

Usage:

Once the script is added to your path, you can run it like so:

git amend-old <target-rev>

Where <target-rev> is the commit hash you'd like to merge your staged changes into.

Example:

# Edit some existing file
vi existing-file.ext
# Stage the changes you just made
git add existing-file.ext
# Combine the staged changes with commit abcd123
git amend-old abcd123

Caution:

I have not thoroughly tested this script, but so far it seems to work okay for my personal usage. It's possible that bugs exist which may cause undesired changes to your Git history. By using this script you agree to the included LICENSE. If you do encounter a bug, I'd appreciate if you'd create an issue or patch for it.

About

Bash script to amend older commits with staged changes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%