From 635d89a90ef42b0ccaf58a3fdb6a4df6a3532258 Mon Sep 17 00:00:00 2001 From: quak Date: Wed, 4 Jun 2025 23:27:55 +0200 Subject: [PATCH] (git) added section on `fixup` --- git.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/git.md b/git.md index f2c0ce2..f6c54f8 100644 --- a/git.md +++ b/git.md @@ -60,9 +60,20 @@ Afterwards the changes can be reapplied with `git stash pop`. This can be useful if for example one would like to create a new branch for the current changes. -## removing files from index +## fixup -To remove files from index without deleting them on disk, use: +Use the argument `--fixup` with the subcommand `commit` to fix a commit. +Afterwards use `rebase --autosquash` to apply the fixup. + +```sh +git add ... # Stage a fix +git commit --fixup=a0b1c2d3 # Perform the commit to fix broken a0b1c2d3 +git rebase -i --autosquash a0b1c2d3~1 # Now merge fixup commit into broken commit +``` + +## removing files from the index + +To remove files from the index without deleting them on disk, use: ```sh git rm --cached ```