Git conflict keeps original

I made a copy of the repo from github. Just playing around the code a bit, made a branch that changed locally and now the source is updated, so I want to delete everything I did before my fork and get the changes made by the upstream.

I get a conflict if I do

git fetch upstream
git merge upstream/master
#Automatic merge failed; fix conflicts and then commit the result.

      

and gives a few changes in the two filenames that I have never done.

So I did a git status that gives me a new filename (which I never did, but was done by my upstream) and Unmerged paths:

#   (use "git add/rm <file>..." as appropriate to mark resolution)

      

for two files.

I want all new changes and destroy the mine. What could be the solution and why does git want me to add a file that I have never done?

+3


source to share


1 answer


Abort the conflicting merge:

git merge --abort

      

then install the local repo with the same commit as upstream, discarding local changes:

git reset --hard upstream/master

      



Regarding your question:

why does GIT want me to add a file that I have never done?

This is not true. It tells you to resolve conflicts in the files you changed, then git add <file>

in those files to mark the edited versions as resolved, and OK to commit.

+3


source







All Articles