From 69707f9d8dab5cebcad52b565db2111da8dbc60b Mon Sep 17 00:00:00 2001 From: Triston Date: Sat, 30 Mar 2024 22:52:59 -0500 Subject: [PATCH] add new squash tut --- tuts/squash_recent_commits.md | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tuts/squash_recent_commits.md diff --git a/tuts/squash_recent_commits.md b/tuts/squash_recent_commits.md new file mode 100644 index 0000000..b1a8093 --- /dev/null +++ b/tuts/squash_recent_commits.md @@ -0,0 +1,44 @@ +# How to squash recent (n) commits + +## TL;DR +```bash +#change this number -👇🏻- to be the number of commits you want to sqaush starting from top most recent +git reset --soft HEAD~2 && git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})" +``` + +## In Depth breakdown +### git reset +explain this +```bash +git reset --soft +``` + +### head +explain this +```bash +HEAD~2 +``` + +### commit edit +explain this +```bash +git commit --edit -m +``` + +### inline command +explain this +```bash +"$(...stuff...)" +``` + +### git log +explain this +```bash +git log --format=%B --reverse +``` + +### head stuff +explain this +```bash +HEAD..HEAD@{1} +```