c# - Is this Git merge already complete - or how to complete it with kdiff3? -


background

i'm newish git , resolving first merge conflict. i'm working in c# using visual studio on scott lilly c# superadventure tutorial. while building tutorial, i'm using github learn scm , git well. part of process, learned have clean master directly follows tutorial without deviation, create branch each chapter, , merge master @ end, , keep experiments on separate branches - way experiments never conflict tutorial when creates new features or refactors existing code.

so far, good. 1 of experiments adding unit tests. started separate unittesting branch, , decided pull in changes master branch keep up-to-date. on first merge, had conflict, in visual studio project file project adding unit tests to, due different packages being installed. not big deal, mechanics tripping me up. there 5 conflicts additions, can merged directly, , 1 case of true conflict. i've gotten of way through it, need final help.

step-by-step far

i'm using a public repo on github, , visual studio 2017 community on windows 10 vs github extension , local git repo - let's face it, visual studio plug-in commands quite limited normal workflow items. - i've started using git bash needed command-line, , git extensions git gui, working pretty well.

i completed chapter 23 of tutorial, , merged chap_23 branch master. tried merge master unittesting, got conflict in superadventureconsole/superadventureconsole.csproj file. git status @ point shows:

$ git status on branch unittesting branch ahead of 'origin/unittesting' 1 commit.   (use "git push" publish local commits) have unmerged paths.   (fix conflicts , run "git commit")   (use "git merge --abort" abort merge)  changes committed:          modified:   superadventure.sln         modified:   superadventureconsole/app.config         modified:   superadventureconsole/properties/assemblyinfo.cs  unmerged paths:   (use "git add <file>..." mark resolution)          both modified:   superadventureconsole/superadventureconsole.csproj  untracked files:   (use "git add <file>..." include in committed)          superadventureconsole/superadventureconsole.csproj.base         superadventureconsole/superadventureconsole.csproj.local         superadventureconsole/superadventureconsole.csproj.remote         superadventureconsole/superadventureconsole.csproj.orig 

at point ran git mergetool based on q: how resolve merge conflicts in git?, runs kdiff3 merge tool (on setup, anyway), original file a file, , local , remote b , c (i'm not sure which). able blunder through one, , pick between b , c each conflict (6 total). got stuck.

at first output file (at bottom below a, b, , c in kdiff3) wasn't taking, on 3rd try, saved , exited kdiff3, , there no longer merge conflict:

$ git mergetool no files need merging 

but, still have untracked files, per "git status":

$ git status on branch unittesting branch ahead of 'origin/unittesting' 1 commit.   (use "git push" publish local commits) conflicts fixed still merging.   (use "git commit" conclude merge)  changes committed:          modified:   superadventure.sln         modified:   superadventureconsole/app.config         modified:   superadventureconsole/properties/assemblyinfo.cs         modified:   superadventureconsole/superadventureconsole.csproj  untracked files:   (use "git add <file>..." include in committed)          superadventureconsole/superadventureconsole.csproj.base         superadventureconsole/superadventureconsole.csproj.local         superadventureconsole/superadventureconsole.csproj.remote         superadventureconsole/superadventureconsole.csproj.orig 

question(s)

it looks modified file saved output kdiff3 , therefore added index, , therefore can commit. correct? assume in case commit complete merge?

overall, i'm not sure happened here - why "git status" show 4 untracked files extension (i.e. .base, .local, .remote, , .orig), shows superadventureconsole/superadventureconsole.csproj without extension in "modified" file list?

i understand .local , .remote, difference between .base , .orig? 1 of these should parent of both branches, 1 it, , other one?

also, there can git bash or using git extensions or git gui double check whether merge ready commit way expect?

thanks!!

it looks modified file saved output kdiff3 , therefore added index, , therefore can commit. correct? assume in case commit complete merge?

this looks it's case. use git diff --cached (or git diff --staged, if prefer: both same thing) compare what's in index right now, i.e., go in new commit, what's in current commit right now. see answer second question.

(git status same git diff --cached --name-status, see files added, deleted, or modified, , not actual change is.)

overall, i'm not sure happened here - why "git status" show 4 untracked files extension (i.e. .base, .local, .remote, , .orig) ...

this bit of mystery: suggests still have git mergetool running.

what git mergetool grub around through mess left behind in index after failed merge. remember, index, aka staging area or cache—three names 1 thing—is place build next commit. has 1 copy of each file go new commit. during failing merge, though, can have three copies of each failed-merge file instead of one.

(it seems 1 file's automatic merge failed, namely superadventureconsole/superadventureconsole.csproj.)

the 3 copies in index are:

  • the merge-base version of file.
  • the current (head, --ours, or—aha!—local) version of file.
  • the other (--theirs or, poor name, remote) version of file.

files in index in special, git-only form, git mergetool extract each of these ordinary file in work-tree. copies failed-merge-result file, left behind in superadventureconsole/superadventureconsole.csproj, .orig.

then, git mergetool runs chosen file-merge program. manipulate file in program. when done, save file , exit. mergetool script compares .orig file final version see if fixed anything, and/or looks @ exit code program.

if looks did failed merge, git mergetool script should remove @ least three, , four, of these files. fact did not suggests git mergetool still running. might check , make sure isn't. perhaps killed off , never had chance clean up.

i understand .local , .remote, difference between .base , .orig? 1 of these should parent of both branches, 1 it, , other one?

the .local file --ours version index (git show :2:<path>, during conflict). .remote file --theirs version (git show :3:<path>). .base file merge-base version (common parent, said; git show :1:<path>). .orig backup of whatever file-level merge left behind. mergetool script uses compare what's left in original file when chosen merge-program exits.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -