git强制拉取代码覆盖本地的

git reset --hard 3b2cbd856874a685d67216086233b9454ee84f27

撤掉已push的代码

git log -5   看下要撤回到哪个版本号  比如要撤回到  7a5a79083a4aaf56487c1acb9e05983a4b412200

git reset --hard 7a5a79083a4aaf56487c1acb9e05983a4b412200

git push origin tags/*** --force

强制撤回git线上仓库文件到aa138b14c0e59d0f94357f7537e97b01f796b2e2日志版本
git reset --hard aa138b14c0e59d0f94357f7537e97b01f796b2e2
强制推到develop分支 
git push origin develop --force
其它人员本地仓库的版本如果是aa138b14c0e59d0f94357f7537e97b01f796b2e2版本之后的  其它人员的本地仓库push时也需要先撤回到aa138b14c0e59d0f94357f7537e97b01f796b2e2版本
否则其它人员会把本地仓库aa138b14c0e59d0f94357f7537e97b01f796b2e2之后的再一并push到线上仓库  
其它人员本地仓库再push时不用加 --force了

其它情况

checkout后仍提示冲突  可以采用checkout -f
git checkout -f custom/ome/model/delivery.php

其它情况 git diff文件没有差异  不能git pull的

git status 提示

# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)

36>$ git status
# On branch dev
# Your branch is behind 'origin/dev' by 6 commits, and can be fast-forwarded.
#
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#       modified:   custom/desktop/lib/finder/builder/prototype.php
#       modified:   custom/ome/controller/admin/order.php
#       modified:   custom/ome/lib/finder/extend/filter/orders.php
#       modified:   custom/ome/model/orders.php
#       modified:   custom/ome/view/admin/order/order_copy.html
#
# Changes not staged for commit:
#   (use "git add/rm ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
#
#       modified:   app/base/kernel.php
#       modified:   app/base/model/queue.php

可以按照提示操作

git reset HEAD custom/desktop/lib/finder/builder/prototype.php
git reset HEAD custom/ome/controller/admin/order.php
git reset HEAD custom/ome/lib/finder/extend/filter/orders.php
git reset HEAD custom/ome/model/orders.php
git reset HEAD custom/ome/view/admin/order/order_copy.html

###然后

git checkout origin/dev custom/desktop/lib/finder/builder/prototype.php
git checkout origin/dev custom/ome/controller/admin/order.php
git checkout origin/dev custom/ome/lib/finder/extend/filter/orders.php
git checkout origin/dev custom/ome/model/orders.php
git checkout origin/dev custom/ome/view/admin/order/order_copy.html

###然后
git pull即可

 

你可能感兴趣的:(git,git)