No Conflicts with Git but Github Shows Conflicts #112811
Replies: 3 comments
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Hi @KohoolateSen , |
Beta Was this translation helpful? Give feedback.
-
maybe you forgot to pull from GitHub first, so all changes in there is not in your local here is the answer of Copilot, The issue you're facing is likely due to differences between your local branch and the branch you're trying to merge into on GitHub. When you create a pull request on GitHub, it's trying to merge your changes into the target branch (in this case, Here's a simplified explanation: Git tracks changes to files, not the files themselves. When you create a pull request, Git tries to apply your changes onto the target branch. If the parts of the files you've changed also have changes in the target branch, Git won't know which changes to keep and which to overwrite, causing a conflict. To resolve this, you need to sync your branch with the latest changes from
git fetch origin
git checkout "my branch"
git merge origin/dev At this point, Git will either successfully merge the changes, or tell you that there are conflicts. If there are conflicts, you'll need to resolve them:
git add <resolved-file>
git commit -m "Resolved merge conflicts"
git push origin "my branch" Now, you should be able to create a pull request on GitHub without conflicts. Remember, it's important to regularly sync your branch with the target branch to minimize conflicts when you create a pull request. |
Beta Was this translation helpful? Give feedback.
-
Hello, I'm new to git and github and I ran into a situation where I made a commit in git and pushed to origin without any conflicts being raised
but when I went to github and createa pull request I found over 20.
I ran the git status command and it returned "nothing to commit, working tree clean."
Here are the step I took:
What did I go wrong here?
Is there a way to tell github to ignore these conflicts and just add my files to dev?
My files don't currently exist in dev so I would expect no conflicts.
Also if someone could tell me in simple terms why git said I had no conflicts but github tells me I have 25 I would be forever in your debt.
Beta Was this translation helpful? Give feedback.
All reactions