有时候我们想在本地修改远程已经提交的某个历史,如果我们在本地修改之后,然后push会有问题,比如说我们先看一下现在的状态:
$ git status
On branch dev
Your branch is behind 'origin/dev' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
但是我们将改动的版本推送到服务器上的时候,会报错如下:
$ git push origin dev
root@192.168.1.180's password:
To ssh://root@192.168.1.180:/home/test_web.git
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to 'ssh://root@192.168.1.180:/home/test_web.git'
hint: Updates were rejected because the tip of your current branch is behin
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') befo