Github

遠端源的 Git 拉合併問題

  • January 12, 2017

我做了git fetchgit fetch --all但沒有相同的輸出。之後,當我再次執行 git pull 時,我再次收到以下錯誤。

我願意將來源從遠端獲取到我的本地。

我什至在下面做了這個,但仍然有一個錯誤。

[root@connect /myurl/fd-ansible]# git fetch origin master
Password:
From https://github.com/myurl/fd-ansible
* branch            master     -> FETCH_HEAD
[root@connect /myurl/fd-ansible]# git clean -df
[root@connect /myurl/fd-ansible]# git pull
Password:
Updating 8bf6b66..a0b2167
error: Your local changes to 'group_vars/system1' would be overwritten by merge.  Aborting.
Please, commit your changes or stash them before you can merge.

使用@Stephen Kitt 解決方案編輯

[root@connect /myurl/fd-ansible]# git checkout group_vars/system1
[root@connect /myurl/fd-ansible]# git pull
Password:
Updating 8bf6b66..a0b2167
Fast-forward
cmdb/vm.csv |  118 +++++++++++++++++++++++++-------------------------
group_vars/system1       |   56 ++++++++++++++++++++++++
2 files changed, 115 insertions(+), 59 deletions(-)

要覆蓋您的本地文件(失去您的更改):

git checkout group_vars/system1

那麼你應該可以git pull

引用自:https://unix.stackexchange.com/questions/336482