0

I did git fetch and git fetch --all but there was no output for the same. after that when I do git pull again I get the below error again.

I am willing to fetch the origin from the remote to my local.

I even did this below but still there is an error.

[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.

Edited with @Stephen Kitt solution

[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(-)
  • Use git fetch instead, not that that will fully resolve the situation—you need to understand Git to use it properly. Also, this question would do better on StackOverflow than here. – Wildcard Jan 11 '17 at 2:47
  • How do you resolve it? Well that depends on that you want to do with the changes - do you want to keep them, add them to the repo or ignore them? – muru Jan 11 '17 at 2:48
  • @Wildcard I attempted to run git fetch it was executed without any output. Does that mean it is done with the merge part. – Mongrel Jan 11 '17 at 2:50
  • @muru I want to overwrite my local file. let me know how can i do that. – Mongrel Jan 11 '17 at 2:54
  • 1
1

To overwrite your local file (losing your changes):

git checkout group_vars/system1

Then you should be able to git pull.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.