githubteacher / github-for-developers-sept-2015

practice repo for the Sept 29-30 GitHub for Developers class
12 stars 36 forks source link

How does one solve "This branch has conflicts that must be resolved" in git while merging pull request? #648

Closed jns111 closed 9 years ago

jaw6 commented 9 years ago

You'll need to update your branch with new commits from master, resolve those conflicts and push the updated/resolved branch to GitHub. Something like this:

git checkout master
git pull
git checkout <branch>
git merge master
[ ... resolve any conflicts ... ]
git add [files that were conflicted]
git commit
git push
shankar26 commented 8 years ago

👍 , it helped me

leonardojulius commented 8 years ago

@jaw6 thanks it helps me :+1:

kirankakkeratd commented 8 years ago

@jaw6 perfect solution :100: . Thanks :+1:

jitendravyas commented 8 years ago

It helped me. thanks

23ranjan commented 8 years ago

Perfect. Thanks.

jitendravyas commented 7 years ago

i get this error

This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.

otisidev commented 7 years ago

every helpful, thank you!

nj1306 commented 7 years ago

If someone getting below error like me

fatal: cannot do a partial commit during a merge.

use -i or --include flag with the commit command

git commit -i -m "Your commit message"

Georodent commented 6 years ago

What do you do in the ----resolve conflicts----- part? Also, will this work with a "conflicting file" as well?

tdk408 commented 6 years ago

On "git checkout ", should it be a new branch created for fixing the conflicts, or the original branch that reported the conflicts?

ningcui-refundlabs commented 5 years ago

perfect solution. Thanks.

sunset12321215 commented 5 years ago

You are in the middle of a merge -- cannot amend. help me please@@

ghost commented 5 years ago

Thanks

veasnama commented 5 years ago

thank sir that really works for me. i never thought i would be fine. this is my day.

Ahkshaey commented 4 years ago

@thanks. Worked like pure magic. Bookmarking it as a great resource when trying to resolve conflicts on git for future reference....

hyungtaecf commented 4 years ago

I got this after trying to merge with master: Automatic merge failed; fix conflicts and then commit the result.

lfc-256 commented 4 years ago

thanks @jaw6!

repl-mohit-kumar commented 3 years ago

the conflict occurred because after ur change, someone else updated that file so Github could not determine which lines to keep and which to remove with ur change when we merged master, we pointed the local HEAD to the master code and with that Github was able to fix the merge conflict automatically.

OmarAlareeki commented 3 years ago

Thank you, this is very helpful

Carlo8699 commented 2 years ago

nice

kazyon commented 2 years ago

what if this error shows at a fork of a repo ?

Wenjie76 commented 2 years ago

Thank you, quite helpful

iLakshya commented 2 years ago

Got the error. Thanks a ton ✌🏻

sachelsout commented 1 year ago

You'll need to update your branch with new commits from master, resolve those conflicts and push the updated/resolved branch to GitHub. Something like this:

git checkout master
git pull
git checkout <branch>
git merge master
[ ... resolve any conflicts ... ]
git add [files that were conflicted]
git commit
git push

Thank you so much !!!

jimka2001 commented 1 year ago

I'm having trouble understand what to do here. I have received a PR which github there contains a conflict. I'd like to resolve the conflict. The message https://github.com/githubteacher/github-for-developers-sept-2015/issues/648#issuecomment-144488223 suggests that I checkout some branch and resolve conflict. BUT WHICH BRANCH? I do not see any branch which contains the conflicting commits.

What do I need to do get get a file containing the <<<<< ====== >>>>> conflict markers so I can fix them manually?

Screenshot 2023-06-10 at 08 17 52
Avedena commented 1 year ago

Hi there,

but how I get the conflicts shown? I do the steps under "Use command line to resolve conflicts before continuing. " but nothing happens in the repro.

https://github.com/Avedena/StyleGAN-Human/pull/1 git checkout -b stylegan-human-main main git pull https://github.com/stylegan-human/StyleGAN-Human.git main git checkout main git merge --no-ff stylegan-human-main git push origin main

Thanks