Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: how to pull latest changes and resolve conflicts

I want to pull in all the latest changes from a github repo. There is only one branch and only one person (the developer) adds and modifies the code. I simply pull everything in, once a new feature is added.

Normally, all I do is:

git pull

But this time I got an error message which reads:

Automatic merge failed; fix conflicts and then commit the results.

I'd simply like to pull in the latest changes from the repo. I'm not sure why there are conflicts when only one person is responsible for this repo.

Note: I don't want to commit anything to the repo.

like image 633
Boosted_d16 Avatar asked Aug 12 '14 09:08

Boosted_d16


People also ask

How do I accept all current changes in git conflict?

git rebase repo. right click file with conflicts without left-click / opening file in editor pane. click "Accept all Incoming" / "Accept all Current"


1 Answers

Basically, if you just watch the repo and do not change the files (or do not want your changes to remain after update) do:

git reset --hard HEAD followed by git pull.

This must overwrite the code on your local machine with code from github repo.

Another option would be git fetch --all followed by git reset --hard origin/master.

like image 197
Andrey Deineko Avatar answered Oct 08 '22 03:10

Andrey Deineko