gt fold
Fold staged changes into a previous commit.
Usage
Options
| Option |
Description |
--into <commit> |
Target commit (default: HEAD) |
Examples
Fold into Last Commit
git add forgotten-file.txt
gt fold
Fold into Specific Commit
git add related-change.txt
gt fold --into HEAD~2
Behavior
- Takes currently staged changes
- Amends the specified commit to include them
- Rebases any commits that come after
Use Cases
- Adding forgotten files to previous commits
- Fixing typos in earlier commits
- Moving changes to a more appropriate commit
Difference from Modify
| Command |
Target |
gt modify |
Always HEAD |
gt fold |
Any commit in the branch |