Questions tagged [merge-conflict-resolution]

When merging branches in a version control system, a merge conflict might arise. This tag is for questions about how such conflicts can be resolved.

See also

755 questions
3
votes
1 answer

git cherry-pick merge conflict pulling in other commits?

For some reason, it looks like git cherry-pick pulls in other commits when flies have merge conflicts. These go away when we use git mergetool but prevent us from manually editing the merge-conflicted file. Does anyone know why this happens? To…
Alan Krueger
  • 4,701
  • 4
  • 35
  • 48
3
votes
1 answer

Why is the file I expect to be present missing after the final merge commit in Mercurial?

I ran into a situation in Mercurial at work where I would expect a file to exist, but it doesn't and I'd like to better understand why. I've put together a repro of the issue. In this repro I would expect the file foo.txt to exist on default after…
3
votes
2 answers

Why is my merge request showing "additions" that are already in my destination branch in GitLab?

I have a staging and main branch in Git that seem to have gotten a bit out of sync. I'm using GitLab, and opened a merge request from stage to main just to see what the difference between the branches is. The difference seems to include "changes"…
3
votes
0 answers

Is it possible to use the patch utility to delete a file?

It is well known how to use patch to create a new file. But how to do the opposite: delete an existing file with arbitrary content, or replace it with given content? Context: suppose there's a directory in the Linux tree with a Makefile and/or…
ddbug
  • 1,392
  • 1
  • 11
  • 25
3
votes
3 answers

When I `git pull --rebase` and get a conflict, how do I `git show` the other person's commit?

So I do git pull --rebase, and there's a conflict. Ok, fine, let's resolve it. I run git diff and the merge conflict diff is a bit confusing. I think I need to git show the two commits that are being merged, and see how they each independently…
Cam Jackson
  • 11,860
  • 8
  • 45
  • 78
3
votes
1 answer

What are the Git conflict markers syntax/rules?

I am interested in what the rules are for the Git conflict markers? Are they stacked? What are the rules to opening (<<<<<<<) and closing (>>>>>>>)? I tried searching the Git docs, but there is nothing explicit about these and the only examples I…
Radu C
  • 303
  • 2
  • 11
3
votes
1 answer

How to keep both files from a “both added” merge conflict?

I want to merge a branch which added a file that I have added as well: Unmerged paths: (use "git add ..." to mark resolution) both added: file I want to resolve this conflict by renaming my version of file to other_file while…
ipsec
  • 680
  • 4
  • 11
3
votes
1 answer

What is the command to list conflicted files path in the source branch

When I tried to merge a source branch into target branch, git recognizes two files to be conflicting. But both these files correspond to different file paths in the source branch and target branch (The file has been moved and modified). I need to…
Goutam Lavudiya
  • 111
  • 1
  • 6
3
votes
0 answers

git overwrites my changes with old version from master

I have looked at similar stackoverflow questions, but none provided a working solution for me. On the current project I am working on, we have a bunch of branches: master: features get pushed on there once they are proven to be stable X feature…
Fly
  • 810
  • 2
  • 9
  • 28
3
votes
1 answer

How do I explicitly mention which branch changes to apply while merging two conflicting branches in git?

I have two branches in git. Master and feature. O---O (master) \ O (feature) I had a text file which contains Master when it is at master branch head. The same file contains feature when it is at feature branch head. I want to rebase the…
Bharat
  • 1,044
  • 15
  • 34
3
votes
0 answers

Automating merge conflict resolution

I'm using git mergetool with beyondcompare4 for solving git merge conflicts. In my project files I often have tags for date/time/version-list that always gives me an merge conflict. I would like to automate the resolutions of those conflicts. For…
3
votes
3 answers

Why do dropped commits from a git rebase cause merge conflicts?

My Problem I have been working on a git repo. Before publishing my changes, I'd like to remove some commits - a023b43, 315424b and 7b51754 - as they do not reflect any meaningful changes. The only important points in time are the first (70f72ca) and…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
3
votes
0 answers

Merge conflict option not show because conflict rows is too far in files

I'm in merge window with conflicting rows. When is conflict row in left side is near conflict row in right side in the middle is option for "choose left, choose right, choose left then right , choose right then left", but when is to far this option…
3
votes
1 answer

Constant conflicts when using mergerequests and releasenotes in git

We record our release notes during development in an .md document. This document contains explanations on features, migration notes and more. When merging feature branches, we often have the problem that conflicts arise within this file, even though…
samjaf
  • 1,033
  • 1
  • 9
  • 19
3
votes
1 answer

git cherry-pick conflict includes unwanted code

My scenario: I have branch B which was created off of branch A. I make a few commits in branch B that I want to cherry-pick into branch C (which is similar to A). I don't want to do a merge of B into C because I don't want certain things from A to…
DB at PS
  • 111
  • 11