In this question Git prevents pushing after amending a commit it is been mentioned that:
This should only be the case if you're amending an already-pushed commit
But what I did was the steps below:
- Pushed a bunch of code
- commit --amend
- commit --amend
- commit --amend
- Pushed
- Pull (CONFLICT (content))
This conflict can happend in the future too, as I don't understand why did conflict happen! Could someone shed some light on the process?
In step 4:
$ git commit --amend
[dev cf0f21d] blahhh(blah) is added
Date: Wed Sep 30 08:39:28 2015 +0330
5 files changed, 168 insertions(+), 1 deletion(-)
In step 5:
$ git push origin dev
To repo:~/something
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to 'repo:~/something'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.