我做了git fetch
,git 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(-)
答案1
覆盖本地文件(丢失更改):
git checkout group_vars/system1
那么你应该能够git pull
。