當 git pull 噴出問題
參閱http://ritto.blog.51cto.com/427838/741342
第1个问题: 解决GIT代码仓库不同步
今天在执行git pull时出现:
[root@gitserver /data/work/www/rest/lib/Business/Inventory]# git pull
Enter passphrase for key '/root/.ssh/id_rsa':
Updating 70e8b93..a0f1a6c
error: Your local changes to the following files would be overwritten by merge:
rest/lib/Business/Inventory/ProductStatus.php
Please, commit your changes or stash them before you can merge.
Aborting
解决方法:
执行git checkout -f,然后再执行git pull重新checkout
[root@gitserver /data/work/www/rest/lib/Business/Inventory]# git checkout -f
Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded.
再执行git pull时就可以了:
[root@gitserver /data/work/www/rest/lib/Business/Inventory]# git pull
Enter passphrase for key '/root/.ssh/id_rsa':
Updating 70e8b93..a0f1a6c
Fast-forward
rest/lib/Business/Inventory/ProductStatus.php | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
mode change 100644 => 100755 rest/lib/Business/Inventory/ProductStatus.php