How to take the version in the remote branch and forget the change that I make in my working directory

I made changes to my working directory and executed a 'git commit'

And then I do git pull. Git is trying to pull the changes in the remote tracking branch and automatically merge it for me. But there are files with a conflict.

So, how can I just take the version in the remote branch and forget the change I made in a specific file?

I am trying to do a 'git checkout - chrome / browser / browser.cc', but he said that I am in the middle of a merge and that will not allow me to do this.

# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       unmerged:   chrome/browser/browser.cc
#       unmerged:   chrome/renderer/render_view.cc
#       unmerged:   chrome/test/automation/automation_proxy_uitest.cc

Thanks.

+3
source share
3 answers

, git reset --hard <remote_commit> . HEAD .

, git checkout -f? , .

+5

git reset --hard HEAD

, git pull () .

0

, git reset --hard HEAD^, - git log, , , do git reset --hard <sha1>. , , , , , . git checkout -b temp --track origin/master, git merge --strategy=ours master git push. , .

, , , , origin/master. .

0

Source: https://habr.com/ru/post/1718967/


All Articles