Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in DevOps and Agile by (29.3k points)

I made a branch called 'f' and did a checkout to master. When I tried the git pull command I got this message:

You have not concluded your merge (MERGE_HEAD exists).

Please, commit your changes before you can merge.

When I try the git status, it gave me the following:

On branch master

# Your branch and 'origin/master' have diverged,

# and have 1 and 13 different commit(s) each, respectively.

#

# Changes to be committed:

.......

# Untracked files:

#   (use "git add <file>..." to include in what will be committed)

#

#   Coachbase/

#   log/development.log.orig

#   log/restclient.log.orig

what should I do?

2 Answers

0 votes
by (50.2k points)

The main reason for this kind of error is your previous pull failed to merge automatically and went to conflict state. And the conflict was not resolved before the next pull

To remove this you need to undo a merge and pull again

For that 

git merge --abort <since Git version 1.7.4>

git reset --merge<for Git version less than 1.7.4>

And then resolve the conflict and don’t forget to add and commit the merge then after that git pull command will work fine.

0 votes
by (1.9k points)

Complete the Merge: In case your merge has not yet been completed, check for any files that still need to be dealt with. Use git status to see the conflicting files.Resolve Conflicts: Open every conflicted file, correct the problems, and then save the file. Stage Changes: After the conflicts have been resolved, stage the changes with:git add <file>Commit the Merge: Commit the merge with a message:git commit -m "Merge branch 'f' into master"Pull Latest Changes: After this you will be able to pull the latest changes from the remote server safely:git pull origin masterAddress Divergence: In cases where you have got a situation where the two branches have become different you will have two choices, either you merge or rebase, choosing the one that suits your workflow.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...