From 298abe80b70d5ddb07e8de0b719f58e7589a3388 Mon Sep 17 00:00:00 2001 From: Chalarangelo Date: Thu, 8 Apr 2021 19:51:24 +0300 Subject: [PATCH] Add fixup commit --- snippets/create-fixup-commit.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 snippets/create-fixup-commit.md diff --git a/snippets/create-fixup-commit.md b/snippets/create-fixup-commit.md new file mode 100644 index 000000000..1db29948b --- /dev/null +++ b/snippets/create-fixup-commit.md @@ -0,0 +1,21 @@ +--- +title: Create a fixup commit +tags: commit,advanced +--- + +Creates a fixup commit that can be autosquashed in the next rebase. + +- Use `git commit --fixup ` to create a fixup commit for the specified ``. +- After running `git rebase --autosquash`, fixup commits will be automatically squashed into the commits they reference. + +```sh +git commit --fixup +``` + +```sh +git add . +git commit --fixup 3050fc0de +# Created a fixup commit for `3050fc0de` +git rebase HEAD~5 --autosquash +# Now the fixup commit has been squashed +```