From 9b189ed2459f70f27b64b77b7e911180a1a222e8 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Tue, 16 Jul 2013 06:55:40 -0700 Subject: [PATCH] Squashing instructions extended --- Squashing-Commits.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Squashing-Commits.md b/Squashing-Commits.md index 4e8625a..7d63375 100644 --- a/Squashing-Commits.md +++ b/Squashing-Commits.md @@ -21,14 +21,18 @@ git push --force origin super-feature ## Alternatives 1. Step-by-step commands ``` +# fetch the current upstream repository +git fetch upstream # resets HEAD to the current upstream git checkout upstream/master # merges all commits from the local branch git merge --no-commit --squash super-feature # re-creates the branch starting from current HEAD (old commits will be lost) git checkout -B super-feature -# lets you edit the commit and checks in the changes +# lets you edit the commit and checks in the changes (you can also use git commit -m "message") git commit -e +# push the changes (in general, be careful with the --force parameter) +git push --force origin super-feature ``` 1. Or, you can use rebase. Let's say you have 5 commits to squash and you don't have merge commits: