| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This Git subcommand script makes it easy to edit, modify, drop, or merge previous commits. It's essentially a more convenient wrapper around git rebase --interactive, with automatic stashing/unstashing and integrated merge conflict handling.
git-edit [-m | --message] <commit>
git-edit [-d | --drop | -s | --squash] <commit>...
MODES:
-e, --edit Edit <commit> (default mode)
-d, --drop Delete (drop) one or more <commit>s or ranges
-s, --squash Merge (fixup/squash) one or more <commit>s into the oldest one
-s <target>, --squash <target> Merge (fixup/squash) <commit>s into <target>
– also assumed when multiple commits are supplied
FLAGS:
-m, --message Alter <commit> message after applying changes
Tip: Mode and flags can be given in any order.
Open the given commit for manual editing, keeping its commit message (or add -m to also edit the message):
git edit 0123456789abcdef0123456789abcdef01234567
This will:
Merge multiple commits into the oldest one among them, keeping only the target commit's message (or add -m to also edit the message):
git edit 0123456789abcdef0123456789abcdef01234567 abcdef0123456789abcdef0123456789abcdef01
Note: You can also use ranges (e.g., git edit HEAD~3..HEAD).
This will:
Make the script available as a Git command by adding its folder to your PATH, e.g. by adding this line to ~/.zshrc:
export PATH="$PATH:/your/path/to/git-edit"
This script rewrites Git history from the chosen commit onward — changing the SHA-1 of that commit and all later commits.
| Back | FazBrowse Home | New Git URL |