Vivek Puri
Vivek Puri

Reputation: 43

Git Unable to pull

I am new to Git, I reverted all of my files so I have no pending changes but when I tried PULL command it showed below errors in output :

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.
git show HEAD:src/app/home/header.component.ts
git show HEAD:src/app/home/header.component.ts

Also I would be grateful, if you suggest some blogs that guide me improve my Git experience.

Upvotes: 1

Views: 4887

Answers (5)

akgupta
akgupta

Reputation: 101

Sometime, it happens. You resolve the merging conflicts and but you find no file to stage. Again you pull, you will get same merging conflict. Then try these steps:

  1. git merge --abort that aborts the ongoing merging activity
  2. Resolve the conflict. As soon as you save the file, you will find the nothing is there to stage. Amazing! isn't it.
  3. Go to the same file and add some space or delete some unwanted code. That's it.
  4. Save this file.
  5. Commit it.
  6. Take a latest git pull before git push
  7. This time you will not receive any conflict message.
  8. Then git push your changes. That's it.

Upvotes: 0

Nicole Zeckner
Nicole Zeckner

Reputation: 53

Also I would be grateful, if you suggest some blogs that guide me improve my Git experience.

GitHub and CodeTree created a free "Try Git" tutorial that may be helpful.

Upvotes: 1

ATrimeloni
ATrimeloni

Reputation: 69

Git thinks that you previously attempted a merge which was not complete. That would occur if you had merge conflicts while attempting a merge. At that point, Git would have been waiting for you to fix your merge conflicts and continue the merge.

Since that never happened, Git is warning you that you are already in the middle of a merge and won't start a new one. You either need to clean up your current merge or abort your current merge before you can pull.

Normal Workflow:

git merge sample-branch
-- oops, conflict
-- fix <conflicted file>
git add <conflicted file>
git commit

The git commit will finish the merge that was in a conflicted state.

If you found you were not sure about what you wanted to merge you can get back to your pre-merge state by running: git merge --abort

You will also be able to verify that you are in the middle of a merge by running a git status. You will see in the status a message about your current merge status.

Upvotes: 2

kowsky
kowsky

Reputation: 14449

Also I would be grateful, if you suggest some blogs that guide me improve my Git experience.

The git TagInfo contains many links to good introductional git literature (especially this one).

Upvotes: 1

Flavien Marianacci
Flavien Marianacci

Reputation: 149

You have to commit. Like the log said.

If you were in merge state you have to finish the merge by commit before pull or push

Upvotes: 4

Related Questions