From a089579cff140da057c7657e91190355c75c2ff0 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Tue, 4 Mar 2014 11:15:35 -0800 Subject: [PATCH] Updated Squashing Commits (markdown) --- Squashing-Commits.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Squashing-Commits.md b/Squashing-Commits.md index 926dd86..5a147a6 100644 --- a/Squashing-Commits.md +++ b/Squashing-Commits.md @@ -20,23 +20,23 @@ git push --force origin super-feature ## Alternatives 1. Step-by-step commands -``` -# fetches 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 (you can also use git commit -m "message") -git commit -e -# pushes the changes (in general, be careful with the --force parameter) -git push --force origin super-feature -``` + ``` + # fetches 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 (you can also use git commit -m "message") + git commit -e + # pushes 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: -``` -git rebase -i HEAD~5 -``` -Change `pick` to `squash` for last four and update the commit message in the editor. +1. Or, you can use rebase. Let's say you have 5 commits to squash and you don't have merge commits: + ``` + git rebase -i HEAD~5 + ``` + Change `pick` to `squash` for last four and update the commit message in the editor.