2

Hi guys this is the scenario,

I'm finding it hard to find an easy to understand scenario tp provide a good context so lets use Umbraco CMS as an example...

Example Context

Lets say I have a working website using this CMS and it has my updates to some configurations in it, views etc, the site works fine. But 6 months a head theres a new version upgrade to the CMS lets say it's Version X.3 and im on X.1 so when I download the new files from the umbraco website for the upgraded version I need to drop these files on top of an existing umbraco working site.

Now the question is:

I know which files were modified by doing a $git status but is there a way to view what sections in a given file has been modifed so I can then choose what I want to keep and what not (they overrride my custome configuration updates), I've tried pretty much everything even doign the upgrade on a separate branch and trying to merge to an existing with the hope I'd get the conflict resolution to appear but it doesnt...

Is there a way of doing this: choosing of what I want to leave and what i want to remove when no conflict resolution is given?

I have found a tool that allows me to do this choosing between what to leave and what to remove, thanks to an article umbraco in 24 days (hence why im using the umbraco example, but not really using umbraco)

This tool allows me to do exactly what I need (Git Extensions)

See Git Extensions allows you to stage or unstage selected lines! this is exactly what i would like to achieve without the use of this tool

I'm also wondering can this be done using sourcetree? havent seen a way to, you definately cant do it in Visual Studio (which is the IDE I'm using, or perhaps i havent found a way)

What i would really like to have happen is to get a conflict in git so i can use my IDE to choose what to leave and what to update, when i merge this from a differnt branch it just overrides everything even if i say $git merge -X ours UpdatedBranch

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Egli Becerra
  • 961
  • 1
  • 13
  • 25
  • `git mergetool` may help. See https://stackoverflow.com/questions/426026/git-on-windows-how-do-you-set-up-a-mergetool. – ElpieKay Jul 04 '18 at 02:53

1 Answers1

1

havent seen a way to, you definately cant do it in Visual Studio (which is the IDE I'm using, or perhaps i havent found a way)

Yet, what you describe looks like Visual Studio merge resolution

  • The conflict notification appears. Click the Conflicts link to start resolve file conflicts.

Prompt when there is a merge conflict when you pull a change

However, this is not your scenario: you seek to add chunk of merged files even when there is no conflict.

That would involve telling Git you want to force a conflict: see "Git - how to force merge conflict and manual merge on selected file". It uses a merge drive which merges the file, but exit with status 1.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks i know what a merge resolution is and I have done it before, the issues is that when the files I'm updating DO NOT show conflict they just override, did you apply a specific merge strategy, what you have shown is what I normally get when i have conflicts, and what I wish I got when I updated the files from the third party update download... see as far as git knows its like me updating the file my self so why would there be a merge conflict when it thinks I have updated the files... If it was as simple as that i wouldnt be posting this. – Egli Becerra Jul 04 '18 at 12:15
  • @EgliBecerra No problem. I'll delete this answer shortly. – VonC Jul 04 '18 at 12:17
  • 1
    @EgliBecerra Maybe this would for a conflict, allowing my answer to then, be relevant? https://stackoverflow.com/a/5091756/6309 – VonC Jul 04 '18 at 12:19
  • The fact that you went out and sought a possible answer is good and I give you thanks for this, I won't flag your answer as negative. the correct answer would be something where i tell git hey git force conflict for every change that was updated by these files being dropped so i can see what changed, theres also the option in VS "Compare with previous version" that allows me to see the diff and what was updated but what I need is the conflict interface even when theres no "apparent" conflict so i can choose what to keep and what to chuck. – Egli Becerra Jul 04 '18 at 12:36
  • It wont let me undo my minus score to you, I'll wait a little then remove the down vote – Egli Becerra Jul 04 '18 at 12:37
  • 1
    @EgliBecerra Thank you. I have rewritten the answer to highlight what you actually want, and point to the possible workaround (merge driver) to force the merge conflict. – VonC Jul 04 '18 at 12:45