0

I'm really new to Git and I'm trying to update my branch to match the master branch since there have been changes I need to download to my branch so I'm on the current workplace. I tried doing git pull origin master --rebase but it says

error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.

I'm not sure exactly what to do and I don't want to accidentally remove files or wipe the whole repo.

torek
  • 448,244
  • 59
  • 642
  • 775
zach_hutz
  • 99
  • 1
  • 2
  • 9
  • Did you try adding the unmerged files? The error message is pretty explicit, what confuses you? – Martin May 12 '21 at 14:38
  • Remember that `git pull` means: *first, run `git fetch`, then run a second Git command to do something with the fetched commits*. The default second command is `git merge`. So `git pull` runs `git fetch`, then runs `git merge`. The merge operation **can stop in the middle** due to conflicts, and when it does, you cannot run another merge because there's one still going on. Probably, you ran `git pull` already, and it stopped in the middle of a merge. Then you ran `git pull` again and this time it wouldn't even *start* a merge because there's still a stopped one to finish first. – torek May 12 '21 at 15:26
  • In your example above, you've used `git pull --rebase`. This changes the *second* command from `git merge` to `git rebase`. However, rebase has the same "can stop in the middle" behavior, and hence the same kind of complaint. – torek May 12 '21 at 15:27

1 Answers1

2

I think you have some uncommit changes within your projects so before rebase or merge first commit them.

"error: Pulling is not possible because you have unmerged files. hint: Fix them up in the work tree, and then use 'git add/rm ' hint: as appropriate to mark resolution and make a commit. fatal: Exiting because of an unresolved conflict."

Is error showing that you have some uncommit changes within your project.

So in your current branch write this command;

git add .
git commit -m "<YOUR COMMIT MESSAGE>"

After that rebase with master

git rebase master

Make sure your local master branch is up to date with remote master, If it is not then write this command

git checkout master
git pull origin/master

Now move back to your branch and write;

git rebase master
Vivek Anand
  • 1,264
  • 8
  • 15