1

I'm having troubles to resolve a problem I have on my working copy: earlier I pulled and it auto-merged a couple of files, they showed then up in the staged area from where I did not commit. I reverted the changes in the files by git checkout -- my/file now, later in the day, I wanted to do another pull but it can't, I got an error like:

$ git pull error: You have not concluded your merge (MERGE_HEAD exists). hint: Please, commit your changes before merging. fatal: Exiting because of unfinished merge. 

how can I fix the situation? I don't want to commit anything on this branch! I also get:

$ git status On branch dev Your branch and 'origin/dev' have diverged, and have 3 and 4 different commits each, respectively. (use "git pull" to merge the remote branch into yours) All conflicts fixed but you are still merging. (use "git commit" to conclude merge) Untracked files: (use "git add <file>..." to include in what will be committed) 
2
  • 1
    git pull means run two Git commands: first, run git fetch, then run a second Git command. The second command defaults to git merge. If you ran git pull earlier, it probably already ran git merge (depending on whether you changed the second command for your git pull). This is probably the reason you're still in the middle of a conflicted merge. You must either finish this merge, or abort it, before you can do another git pull. Commented May 7, 2020 at 2:43
  • (You might be best served by working through a good Git tutorial. Git is notoriously beginner-hostile, and you're right in the middle of one of these things right now.) Commented May 7, 2020 at 2:46

1 Answer 1

2

First, a git merge --quit (Git 2.23+) should help get rid of the merge in progress.

Second, git pull --rebase should help replaying your local commits on top of an updated origin/dev.

Then you can push.

The OP BitFreak made it work (see comment) with:

git push --abort git pull --rebase 
Sign up to request clarification or add additional context in comments.

2 Comments

the right command is git merge --abort, git pull --rebase resolved the issue as desired! Great, thanks!
@BitFreak Great. I have included your comment in the answer for more visibility.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.