Github - Resolve Conflcits UI shows conflict but there isn't - github

Github UI shows conflict even though when I merge main into feature-branch locally there is no conflict.
<<<<<<< feature-branch
print('Hello')
=======
>>>>>>> main
I solve the issue by manually merging feature-branch into main and then pushing to main, but this is not convenient.

Related

How to view resolved conflicts only in a Pull Request of a merge (no other changes) on GitHub?

We have a protected feature branch (EPIC) with pull request to master.
That feature branch has conflicts now.
To resolve conflicts we have to open a new pull request with merged master and resolved conflict based on EPIC.
When reviewing the new PR we see all changes from master (which can be really a huge amount of changes) and changes on conflicts.
What we are interested in, is just to review changes on conflicts, not the whole history from master.
Is there a way to hide all changes from master on GitHub and view only resolved conflicts?

Git pull request - conflict

I am working in my local branch-1 and my colleague works on his local branch branch-2.
He already committed and pushed the branch to his origin/develop and created a Pull request to upstream/develop. So now it is waiting for review and approving the pull request by someone else.
The problem is, in my local branch I need to edit one same file, which my colleague worked on. So my branch and his branch will containe the same file with different code. If his branch would be already in upstream, then I could merge it to my branch and resolve the conflict locally without problems.
However now it is in Pull request status waiting for review and I don't have time to wait, I need to create also my Pull request.
How and when will the conflict be solved, as the file with conflict is in both pull requests now, will git recognize it now or? As those branches are not in upstream yet.
Whichever branch is merged first, the other PR will have a merge conflict that must be resolved. If yours is merged first, theirs will suddenly have to fix a conflict. If their PR is merged, yours will have a conflict.
The PR main page will show the conflict and won't allow it to be merged.
The other answer is the correct one, but I want to add another possible course of action.
If your two separate features need to follow (for whatever business/architecture related reasons) merging order, where branch-1/feature-1 must be before branch-2/feature-2 and also at the same time, you need to create a PR for your feature, then what you need to do is rebase your branch on top of your colleagues branch and create a PR that way.
Once branch-1 is merged, then rebase branch-2 onto the latest upstream/develop. This will force you to resolve conflicts and update the PR accordingly.

GitHub - PR linked issue does not gets closed when non-default branch is merged with main

I have main as default branch and dev as non-default.
I created one issue and one PR to merge from new temp branch to dev branch
In PR, I have mentioned Resolves #1.
When I merge PR to dev branch, the issue #1 does not gets closed as it is non-default branch.
Then I using git commandline inside main branch, I did git merge dev so dev branch is merged to main.
In main branch commits, I can see the Merge pull request ... commit as well.
But the issue #1 does not gets closed even as PR is indirectly merged to main (from temp to dev to main)
Any reasons for the bug ?
Update: -
When merging dev to main , next time I did not used git merge dev on main branch, but I created new PR to merge dev to main.
And it closes the issue.
Why I worked while merging with PR and not when git merge is used ?
This is by design and not a bug
When you merge a linked pull request into the default branch of a repository, its linked issue is automatically closed
And
Note: The special keywords in a pull request description are interpreted when the pull request targets the repository's default branch. However, if the PR's base is any other branch, then these keywords are ignored, no links are created and merging the PR has no effect on the issues. If you want to link a pull request to an issue using a keyword, the PR must be on the default branch.
From
https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue
PS: I have emailed GitHub support also for this in the past. Unfortunately is hasn't changed (yet)

github 'resolve conflicts' button disabled

I'm an admin on this repo. In this PR I have removed multiple files and merged these changes from local to origin/develop. When merging origin/develop to origin/master I'm getting this conflict for one of the four files I've removed. Our flow is always local to origin/develop to origin/master. I had no conflicts when mergin local to origin/develop.
Github won't let me resolve the conflict.
Questions:
Why is the 'Resolve Conflicts' button disabled? I've never seen this before.
Why would this one file have a merge conflict? It's one of 3 config files that I removed completely in this PR.
Why am I getting this conflict on origin/develop to origin/master when I had no conflicts on local to origin/develop?
If the Resolve conflicts button is deactivated, your pull request's merge conflict is too complex to resolve on GitHub Enterprise or the site administrator has disabled the conflict editor for pull requests between repositories. You must resolve the merge conflict using another Git client like Atom's Git integration or the command line.
I know this is little old post. But putting my answer as I also faced the same issue and I could solve it using following.
As shown in screenshot attached, you can solve this on your local using command line.
Fetch the branch which has conflicts. (say master branch)
Checkout to that branch.
Pull the code from another branch you want to merge it into. (Take a pull from develop into master )
OR Rebase the branch as: checkout to develop branch, then take pull into it git pull origin develop. Then checkout to master branch and do git rebase develop.
Now resolve the conflicts, add the changed files, commit it, push onto the branch you want to merge it into (in this case master ). It might happen that you don't have permission to do it. In that case you can push this branch on your fork, and then raise PR to main repo)
There is one more method.
Using GitHub Desktop. Just that, it is not available for linux from official site.
For this you can check this link.
Read the instructions in the README doc and install it accordingly.
And you can find the method to solve the conflicts using GitHub Desktop here.

EGit Pull, Push, Merge, not working

After pulling updates to a project I am working on with some partners, Eclipse Git is not allowing me to continue pushing, pulling or merging.
When I last pulled the updates, there were conflicts in the web.xml, so I deleted the conflicting text and saved just the correct one. However, Eclipse is continuing to show the double-diamond icon on the web.xml file, indicating there are conflicts. When I try to pull again, I get:
Cannot pull into a repository with state: MERGING
org.eclipse.jgit.api.errors.WrongRepositoryStateException
When I try to push my own commit I get
This is what it looks like in the History view
How do I solve these issues and sucessfully push my commit?
First reset your HEAD from the merge state to previous commit
Add files to Index
Fetch, Pull from the Origin
Merge the branch, Resolve if any conflicts
Commit and Push the Merge