From 69204cdf0acbab201619d95ad8295928e7f411d5 Mon Sep 17 00:00:00 2001 From: Kate Hudson Date: Tue, 29 Jul 2014 13:14:46 -0400 Subject: [PATCH] Fixes #6: Force pushing after amending commits --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cd504cf..1ec8479 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,13 @@ For clarity's sake all examples in this document use customized bash prompt in o ``` (my-branch*)$ git commit --amend + ``` +### I tried to push my amended commit to a remote, but I got an error message + +Note that, as with rebasing (see below), amending **replaces the old commit with a new one**, so you must force push (`-f`) your changes if you have already pushed the pre-amended commit to your remote. Be careful when you do this – *always* make sure you specify a branch! + ## I need to combine commits You need to do something called an interactive rebase. @@ -172,7 +177,7 @@ hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. ``` -Since rebasing **replaces the old commit(s) with a new one**, you must force push (`-f`) your changes. Be careful when you do this - *always* make sure you specify a branch! +Since rebasing **replaces the old commit(s) with a new one**, you must force push (`-f`) your changes. Be careful when you do this – *always* make sure you specify a branch! ``` (mybranch) $ git push origin mybranch -f