I clone my own repository from github
to local machine, do a small change, then git push
it. The git log
likes this:
3: xxxxx
2: yyyyy
1: zzzzz
I suddenly find there is an error in commit 3
, so in local repository, I do git reset 2
first, modify the file again, then git commit
it. So the git log
changes to this:
4: ttttt
2: yyyyy
1: zzzzz
This time when I git push origin
, the git
complains:
To https://github.com/NanXiao/torch.git
! [rejected] patch-1 -> patch-1 (non-fast-forward)
error: failed to push some refs to 'https://github.com/NanXiao/torch.git'
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.
So how can I revert the remote repository? Make the remote repository's git log
like this:
4: ttttt
2: yyyyy
1: zzzzz