0

I'm working on two branches (main and dev) because I'm developing two similar functionalities and I wanted to test them, which one works better and it turned out that on one branch there is a subfunction that works better and on the other there is the rest of the code,

I thought that when I do a merge, it will show the conflict and I can manually choose which lines of code I will leave and which I will discard. (I'm using Azure DevOps) Unfortunately git doesn't see the conflict and just overwrites file on main with the file from the other branch

Is it possible to compare two files during merge and choose what to add? I only see an option that compares files, but it is read-only... and I can't make changes. I would like to do it professionally (now I put the text that causes the conflict). I would like to have this option (or similar) always available. git conflict on Azure DevOps

18michal
  • 21
  • 5
  • conflicts it's against the target branch, when you will merge one pr in the second will be conflicts. – Shayki Abramczyk Jul 05 '23 at 15:56
  • You said you're working on 2 branches but you didn't say if one of them is `main`, or if `main` is a third branch. If it's a third branch then of course you won't have conflicts when merging one into `main`, if the branch is up to date with `main`. But even if you merge one branch into the other it's still possible to not have conflicts if none of the *lines* in the files conflict. Perhaps try using `git merge --no-commit [commit-or-branch-to-merge]` which will stop before completing the merge, and allow you to inspect the staged files, and change them and re-stage before completing it. – TTT Jul 05 '23 at 16:09
  • One way to think about this is that you wish Git to treat every change as a conflict, so you can use the conflict resolution tools for picking and choosing all changes. If that's what you want, then this is likely a dup of of [this question](https://stackoverflow.com/questions/10131577/forcing-git-merge-to-declare-all-differences-as-a-merge-conflict). – TTT Jul 05 '23 at 19:26
  • https://stackoverflow.com/questions/31644096/git-merge-treat-any-auto-file-change-as-a-conflict-do-not-stage-like-a-sq – matt Jul 05 '23 at 20:25

0 Answers0