FHIR Chat · vsCache conflict hell · committers/git-help

Stream: committers/git-help

Topic: vsCache conflict hell


view this post on Zulip Eric Haas (Jun 19 2019 at 04:45):

I can seem to get this branch to build. all I did was update some html and I am getting all these gd conflicts. Tried deleting the VsCache file, merging etc. can not seem to locate the conflicts when I pull it up on my editor either.

view this post on Zulip Eric Haas (Jun 19 2019 at 04:45):

https://github.com/HL7/fhir/pull/588

view this post on Zulip Eric Haas (Jun 19 2019 at 04:47):

deleted the cache and running the build locally to see if that fixes it.

view this post on Zulip John Moehrke (Jun 19 2019 at 14:30):

GIT-Helpers --- is it possible to tell a branch to revert some files back to master? (e.g. Eric's situation with some .cache files in the docref branch)

view this post on Zulip John Moehrke (Jun 19 2019 at 14:37):

alternative... as the branch initiator, can I reject Eric's adds of these cache files, while accepting other html/xml changes?

view this post on Zulip Eric Haas (Jun 19 2019 at 14:52):

HI John I just tried to push some changes to the intro and definition.. I did not open excel all in text editors. I think if revert back to the last successful merge and try again is the ticket.

view this post on Zulip Eric Haas (Jun 19 2019 at 14:59):

sign...my local branch is now toast as well.

view this post on Zulip John Moehrke (Jun 19 2019 at 15:58):

so. my copy of the branch does build locally, but GIT does tell me there was some issues.. how do I REJECT your additions to my branch? (selectively reject some files, as some are fine) or (reject them all, and re-apply your useful changes to my branch and re-submit?

view this post on Zulip John Moehrke (Jun 19 2019 at 15:59):

@Josh Mandel @Grahame Grieve @Rob Hausam ????

view this post on Zulip Rob Hausam (Jun 19 2019 at 16:44):

It looks to me like you just need to resolve the conflict in the loinc.cache file?

view this post on Zulip John Moehrke (Jun 19 2019 at 16:51):

okay... how do I REJECT Eric's update where he added that loinc.cache file? This add was unnecessary.

view this post on Zulip John Moehrke (Jun 19 2019 at 16:52):

(note not complaining about Eric... just trying to learn GIT)

view this post on Zulip John Moehrke (Jun 19 2019 at 16:54):

or another learning opportunity... How do I tell GIT that the conflict it thinks exists is a figment of GIT's imagination.

view this post on Zulip Rob Hausam (Jun 19 2019 at 17:10):

I think there are at least a few approaches that can be used to deal with this. I am curious why Eric apparently made commits to your work branch?

view this post on Zulip John Moehrke (Jun 19 2019 at 17:14):

because this branch is a group project... I am VERY happy with the majority of Eric's adds...

view this post on Zulip Eric Haas (Jun 19 2019 at 17:41):

my ears are burning :-) The question is how to go back? resolving those conflicts is nigh impossible for me at leasr

view this post on Zulip Josh Mandel (Jun 19 2019 at 18:02):

If you've got a branch (my-feature-branch) checked out locally and you want to blow away all cache changes since that branch diverged from master, do:

# Make sure you're up to date with all remote branches
$ git fetch

# should show you're on my-feature-branch
$ git status

# Grab all vscache files from the origin/master branch
$ git checkout origin/master -- vscache

# should show you're still on my-feature-branch
# ... and should show "Changes to be committed" in vscache
$ git status

# Commit the changes locally
$ git commit -m "Reset vscache changes"

view this post on Zulip Josh Mandel (Jun 19 2019 at 18:34):

Obviously the git status commands don't do anything; I just included them to help you follow along and check that things are working as expected.

view this post on Zulip John Moehrke (Jun 19 2019 at 19:02):

is that what we want to do? The branch I have locally is building... but the pull-merge request that Eric submitted is complaining about conflicts. I just want to tell it that those conflicts are OKAY. or I want to tell it to forget some files that Eric added to that branch... I don't know that either of those are what you described. I don't know what a "blow away all cache changes since that branch diverged from master" means, but it seems like that is describing the destruction of the whole branch. The branch is 99% perfect, and that 1% that GIT is complaiing about --> Doesn't matter AT ALL.

view this post on Zulip Rob Hausam (Jun 19 2019 at 19:28):

Unless I'm somehow misunderstanding, if your local branch is building fine but the auto-build is failing due to a conflict, then you must have some uncommitted and/or unpushed changes in your local branch. If that's the case, then committing and pushing those changes to the upstream branch and thereby revising the pull request should resolve the auto-build conflict. If there's something that I've missed in that you can let me know.

view this post on Zulip Grahame Grieve (Jun 19 2019 at 19:30):

local build is not related to conflict or not

view this post on Zulip Rob Hausam (Jun 19 2019 at 19:38):

not sure what point you are making

view this post on Zulip Josh Mandel (Jun 19 2019 at 19:51):

I'm confused too.

view this post on Zulip Josh Mandel (Jun 19 2019 at 19:51):

But from what Grahame said, reverting cache files to the way they look in master should never cause a build to fail.

view this post on Zulip Josh Mandel (Jun 19 2019 at 19:51):

So it should be a "safe" operation.

view this post on Zulip Rob Hausam (Jun 19 2019 at 19:51):

agree

view this post on Zulip Josh Mandel (Jun 19 2019 at 19:51):

A conflicted file is never "okay" -- because it contains markers like ">>>>>" indicating where the conflict is, which makes it invalid json, or java, or markdown, or whatever.

view this post on Zulip Grahame Grieve (Jun 19 2019 at 20:00):

right. but a conflict in the branch doesn't mean you'll have a conflict locally

view this post on Zulip John Moehrke (Jun 19 2019 at 20:01):

so I have a working build, How do I force into my remote branch the file that I have locally? because GIT thinks things are sync but conflicted

view this post on Zulip Grahame Grieve (Jun 19 2019 at 20:02):

so it's common for you to have a local build that works fine, and is synced between your local copy and your branch on the github repo, but is still a conflict with the master

view this post on Zulip Grahame Grieve (Jun 19 2019 at 20:02):

How do I force into my remote branch the file that I have locally? because GIT thinks things are sync but conflicted

like that. running the resolve should work...

view this post on Zulip Grahame Grieve (Jun 19 2019 at 20:02):

http://wiki.hl7.org/index.php?title=GIT_conflict_resolution_documentation

view this post on Zulip John Moehrke (Jun 19 2019 at 20:11):

so, we don't yet want to merge this branch with master... It feels to me like these instructions are telling me how to merge my branch into master. I don't want to merge my branch into master.

view this post on Zulip John Moehrke (Jun 19 2019 at 20:12):

if these instructions are the ones I do want to do... how do I do them with Tortoise GIT (it is a supported tool, right?)

view this post on Zulip Rob Hausam (Jun 19 2019 at 20:15):

the reason for making a pull request is that you do want to merge your branch into master
if you don't want to do that then there isn't a need to worry about (or even know about) the conflict
the conflict resolution instructions involve merging the changes in the upstream master into your local branch - then if there are conflicts you can see them (and fix them) locally so that you will be able to merge your branch into master, whenever you are ready to do that

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:16):

Those instructions don't merged anything -- they grab content from master (just in the vscache folder) and bring them into your working tree.

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:16):

I don't know the details of how Tortoise works.

view this post on Zulip Rob Hausam (Jun 19 2019 at 20:17):

I don't use TortoiseGit (tried it once, I think) so I can't help much there

view this post on Zulip Grahame Grieve (Jun 19 2019 at 20:17):

those instructions to do not lead to committing the PR, just fixing the PR

view this post on Zulip Rob Hausam (Jun 19 2019 at 20:17):

yes

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:20):

I think you mean "do not lead to committing", and to be clear: they add a commit, but they don't push to GH, and they don't merge the PR into master.

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:20):

To push to GH you'd git push, and the merging would happen via the GH web interface.

view this post on Zulip Grahame Grieve (Jun 19 2019 at 20:21):

my instructions push reconciled changes up to GH on your branch

view this post on Zulip Grahame Grieve (Jun 19 2019 at 20:21):

but they don't do the merge

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:21):

Sorry, thanks -- I misunderstood what "those" referred to. Now I see it was your link, not my instructions above.

view this post on Zulip Grahame Grieve (Jun 19 2019 at 20:21):

oops sorry

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:22):

The instructions Grahame shared do indeed involve a merge, but it's a merge from master into the feature branch, rather than the other way around. @John Moehrke that's the important insight.

view this post on Zulip Rob Hausam (Jun 19 2019 at 20:22):

right

view this post on Zulip John Moehrke (Jun 19 2019 at 20:33):

Okay, so help me baby steps... I have on my local branch reverted these cache files to master... Now how do I put those reverted versions into my PR?

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:35):

Sure thing. Did you revert according to my instructions or Grahame's link?

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:37):

And can you share the output of git status?

view this post on Zulip John Moehrke (Jun 19 2019 at 20:38):

Hm, this is difficult without a common understanding of tool, and my use of tortoise seems to be stressing things.

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:38):

I agree:)

view this post on Zulip John Moehrke (Jun 19 2019 at 20:38):

I reverted by just using the revert menu... as these vsCache files should have NEVER been included in the branch... I would prefer to just REMOVE them from the branch

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:38):

Sorry I can't give you help in your preferred language .

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:39):

Removing files from a branch only makes sense if you're planning (when you merge back into master) to have the files deleted from master, too.

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:40):

Which isn't the case here

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:40):

If you hit "revert" in tortoise, I'm guessing that would just revert to the content in your own branch, not master.

view this post on Zulip Grahame Grieve (Jun 19 2019 at 20:41):

TortoiseGit is convenient for normal use, but please use the command line when following command line instructions

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:41):

You probably want to follow the instructions from me or Grahame rather than doing a third thing

view this post on Zulip John Moehrke (Jun 19 2019 at 20:43):

okay, I have git in my command line.

view this post on Zulip John Moehrke (Jun 19 2019 at 20:43):

git status gives me

view this post on Zulip John Moehrke (Jun 19 2019 at 20:43):

On branch moehrke-docRef
Your branch and 'origin/moehrke-docRef' have diverged,
and have 1 and 24 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Untracked files:
(use "git add <file>..." to include in what will be committed)

git.txt
publishout.txt
vscache/media-type.cache

nothing added to commit but untracked files present (use "git add" to track)

view this post on Zulip John Moehrke (Jun 19 2019 at 20:45):

so, now you want me to do all the instructions in grahame's wiki page? staring with git fetch origin?

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:45):

So you've made local changes distinct from the changes someone else (Eric?) has pushed to your "shared branch"

view this post on Zulip John Moehrke (Jun 19 2019 at 20:46):

I thought that I pulled Eric's changes and did a build local

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:46):

Having a shared branch is fine, but you need to know how to keep this kind of thing up to say.

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:46):

You might try "git pull"

view this post on Zulip Grahame Grieve (Jun 19 2019 at 20:46):

@Josh Mandel wondering whether it's at the point that John should start again with his local copy

view this post on Zulip Josh Mandel (Jun 19 2019 at 20:47):

That'd be fine too -- but to be clear, nothing has been lost and nothing requires more than a couple of commands to restore. It might still be easier for you to blow it all up.

view this post on Zulip John Moehrke (Jun 19 2019 at 20:50):

Starting new is what I did two weeks ago... Do I really need to do that?

view this post on Zulip John Moehrke (Jun 19 2019 at 20:50):

It was not my intention that others would provide updates to my branch before merge... but it should work, right?

view this post on Zulip John Moehrke (Jun 19 2019 at 20:51):

The problem is that Eric submitted into my branch some files that are not versioned and therefore should not have been included in my branch...

view this post on Zulip Rob Hausam (Jun 19 2019 at 20:51):

you don't have to do that, as Josh said
but there are still at least probably a couple of steps to get it all back into sync if you don't

view this post on Zulip John Moehrke (Jun 19 2019 at 20:51):

My best thought is that I want to reject his add of the vscache files to my branch

view this post on Zulip John Moehrke (Jun 19 2019 at 20:52):

which is what I have done by reverting to the master version of these vscache files locally

view this post on Zulip John Moehrke (Jun 19 2019 at 20:52):

or I think that is what I have done

view this post on Zulip Rob Hausam (Jun 19 2019 at 20:54):

I think I would just merge all of the changes (from master, Eric, etc.) into the local branch and then resolve whatever conflicts there are locally
resolving the conflict(s) might be as easy as just checking those files out fresh from master and then making new commit(s) of any changes (if there are any)

view this post on Zulip John Moehrke (Jun 19 2019 at 20:59):

so the I think the conflict is simply vscache/loinc.cache

view this post on Zulip John Moehrke (Jun 19 2019 at 20:59):

so how do I make my change into the remote branch?

view this post on Zulip Grahame Grieve (Jun 19 2019 at 21:00):

commit to the remote branch

view this post on Zulip Josh Mandel (Jun 19 2019 at 21:01):

I think you want to say "fix locally and
push a commit to the remote"

view this post on Zulip Grahame Grieve (Jun 19 2019 at 21:01):

yes

view this post on Zulip Josh Mandel (Jun 19 2019 at 21:01):

(Not to be pedantic, but accuracy matters here.)

view this post on Zulip John Moehrke (Jun 19 2019 at 21:04):

I am so confused

view this post on Zulip Rob Hausam (Jun 19 2019 at 21:08):

I think if you follow Grahame's instructions for that file (for "fix" and "committing", if you've already done the "set up"), that should do it

view this post on Zulip Grahame Grieve (Jun 19 2019 at 21:12):

my instructions may fail since John has already diverged from the remote branch. They assume no divergence

view this post on Zulip John Moehrke (Jun 19 2019 at 21:14):

I am cloning into a new local repository...

view this post on Zulip John Moehrke (Jun 20 2019 at 00:41):

okay back to working with my working copy of my branch.. I have done a clean build... but when I try to push I get the cache//loinc.cache conflict. So I follow Grahames instructions and FAIL this way

view this post on Zulip John Moehrke (Jun 20 2019 at 00:41):

C:\Users\john.moehrke\Git\fhirD>git checkout --theirs vscache/loinc.cache
Updated 1 path from the index

C:\Users\john.moehrke\Git\fhirD>git commit -m "fix vscache/loinc.cache conflict"

[moehrke-docRef 45c830ca44] fix vscache/loinc.cache conflict
118 files changed, 89093 insertions(+), 13452 deletions(-)
rewrite fhir-error-dump.html (98%)
rewrite source/specimendefinition/specimendefinition-spreadsheet.xml (68%)

C:\Users\john.moehrke\Git\fhirD>git push
To https://github.com/HL7/fhir
! [rejected] moehrke-docRef -> moehrke-docRef (non-fast-forward)
error: failed to push some refs to 'https://github.com/HL7/fhir'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

C:\Users\john.moehrke\Git\fhirD>

view this post on Zulip Josh Mandel (Jun 20 2019 at 02:55):

The hint is spot on: looks like you haven't done a git pull

view this post on Zulip Rob Hausam (Jun 20 2019 at 04:12):

Yes. The hints are normally (or probably always) accurate and following them is very helpful. Maybe it's sometimes less clear when using TortoiseGit (or other tool) whether the pull has been done or not (not sure, just wondering)? Doing it via the command line doesn't leave any doubt.

view this post on Zulip John Moehrke (Jun 20 2019 at 14:16):

okay... tried that...
C:\Users\john.moehrke\Git\fhirD>git pull
error: The following untracked working tree files would be overwritten by merge:

    vscache/media-type.cache

Please move or remove them before you merge.
Aborting

C:\Users\john.moehrke\Git\fhirD>del vscache\media-type.cache

C:\Users\john.moehrke\Git\fhirD>git pull
CONFLICT (modify/delete): vscache/loinc.cache deleted in 93fed714344924f05137aad
d182c651ea36edbd8 and modified in HEAD. Version HEAD of vscache/loinc.cache left
in tree.
Automatic merge failed; fix conflicts and then commit the result.

C:\Users\john.moehrke\Git\fhirD>

view this post on Zulip John Moehrke (Jun 20 2019 at 14:17):

so WHAT does "fix conflicts..." mean? If I understood what a conflict was, I would likely be way ahead of the process.

view this post on Zulip Rob Hausam (Jun 20 2019 at 14:41):

"Fix conflicts" means basically that where there are non-mergeable (incompatible) differences between two versions of the file, you have to choose which version of the differences you want to use (or even something different, if that's appropriate). As Josh mentioned earlier, when Git detects a conflict it inserts conflict markers like ">>>>>" into the file which indicate where the conflict is - and the presence of those markers makes the file invalid json, or java, or markdown, or whatever it is. So, to fix the conflict you remove those markers and the marked up sections of the file that you don't want and then save and commit the fixed version. Tools can do that, or you can do it by hand using an editor. I think that doing it by hand editing probably is going to make what's happening more obvious and easier to understand (at least until you're comfortable with how it is working).

view this post on Zulip John Moehrke (Jun 20 2019 at 16:37):

okay, logically I follow you...

view this post on Zulip John Moehrke (Jun 20 2019 at 16:37):

so it is complaining about vscache/loinc.cache

view this post on Zulip John Moehrke (Jun 20 2019 at 16:38):

I look at that file on my filesystem, and don't find any ">>>>"

view this post on Zulip John Moehrke (Jun 20 2019 at 16:38):

so, where do I go to see these ">>>>"?

view this post on Zulip Rob Hausam (Jun 20 2019 at 16:41):

all I can say is, if git status shows a conflict on that file locally then the conflict markers should be there and you should see them when you open the file to view or edit
is that what's happening?

view this post on Zulip John Moehrke (Jun 20 2019 at 16:49):

here is git status
C:\Users\john.moehrke\Git\fhirD>git status
On branch moehrke-docRef
Your branch and 'origin/moehrke-docRef' have diverged,
and have 2 and 24 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)

Changes to be committed:

    new file:   vscache/media-type.cache

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

    modified:   source/status-codes.xml
    modified:   vscache/null.cache

Untracked files:
(use "git add <file>..." to include in what will be committed)

    git.txt
    publishout.txt

C:\Users\john.moehrke\Git\fhirD>

view this post on Zulip John Moehrke (Jun 20 2019 at 16:50):

so the untracked are expected.. no issue there.

view this post on Zulip John Moehrke (Jun 20 2019 at 16:53):

vscache/media-type.cache SHOULD NOT be a tacked file. It seems in one of Eric's updates he added it.

view this post on Zulip John Moehrke (Jun 20 2019 at 16:54):

this is why I want to know how I can reject an update of my branch made by Eric.

view this post on Zulip John Moehrke (Jun 20 2019 at 16:55):

This one specifically https://github.com/HL7/fhir/pull/588/commits/f12e397dfa83f560dfde3ba1e1aca58114f0b27e?file-filters%5B%5D=

view this post on Zulip John Moehrke (Jun 20 2019 at 17:09):

SO two things that I need help with (1) How do I revert media-type.cache back to not tracked? (2) what exactly do I do about the modified things? I don't find any ">>>>" in my local files, so how do I force my files into the remote branch?

view this post on Zulip Rob Hausam (Jun 20 2019 at 17:34):

I'll take a look at it locally and see what I find on my end.

view this post on Zulip Grahame Grieve (Jun 20 2019 at 19:16):

media-type.cache should be tracked.

view this post on Zulip Grahame Grieve (Jun 20 2019 at 19:17):

it seems that people are tripping up on these terminology cache files, but they save you approximately 90 min time on the build.

view this post on Zulip John Moehrke (Jun 20 2019 at 19:17):

ah, okay. it is not marked as tracked in my repository that is just master

view this post on Zulip Rob Hausam (Jun 20 2019 at 19:18):

I did a local build on the branch and committed/pushed the updated files (loinc.cache and null.cache). Then I merged from master into moehrke-docRef, which showed the loinc.cache conflict locally. I then did git reset -- vscache/loinc.cache and git checkout MERGE_HEAD -- vscache/loinc.cache to get the copy of loinc.cache from the master branch and commited/pushed those changes, and the pull request check completed successfully - the conflict is resolved.

view this post on Zulip John Moehrke (Jun 20 2019 at 19:19):

whew. thanks

view this post on Zulip John Moehrke (Jun 20 2019 at 19:20):

can you explain in purely human english what the git reset... and git checkout... are?

view this post on Zulip Rob Hausam (Jun 20 2019 at 19:30):

I can try. I started with trying the git checkout --theirs [path] in Grahame's instructions, but it didn't work. Some further reading indicated that might have to do with the version of git. I tried the alternative suggestion for git versions < 1.61 (I didn't check into which versions we're actually using) as documented here, which did work. The alternative would have been to hand edit the file as I mentioned before (which wouldn't have been too hard to do), but I decided to try this way with just replacing the file outright first.

view this post on Zulip Eric Haas (Jun 20 2019 at 23:01):

@Rob Hausam is our hero. but

view this post on Zulip Eric Haas (Jun 20 2019 at 23:01):

The alternative would have been to hand edit the file as I mentioned before (which wouldn't have been too hard to do), but I decided to try this way with just replacing the file outright first.

view this post on Zulip Eric Haas (Jun 20 2019 at 23:03):

I tried and I could fix the conflicts nor find any after a second try ( no >>>>) so not always so straitforward to fix conflicts.

view this post on Zulip Eric Haas (Jun 20 2019 at 23:03):

I will need to remember that trick.

view this post on Zulip Eric Haas (Jun 20 2019 at 23:08):

@GG as I understand the vscache should be committed with the rest of the changes, but they are poorly understood and set you up for faliure like this which took > 90 minutes to resolve. Is there something we should do to make sure they are always up to date?

view this post on Zulip Grahame Grieve (Jun 20 2019 at 23:09):

if people always commit them, they're always up to date

view this post on Zulip Grahame Grieve (Jun 20 2019 at 23:09):

the problem I think this time is that I changed the format of all of them by adding language support to the terminology sub-system

view this post on Zulip Eric Haas (Jun 20 2019 at 23:10):

Why do you think this occured? I just edite a intro.html file and text edited a definition in an xml file? The branch was over a week old.

view this post on Zulip Rob Hausam (Jun 20 2019 at 23:10):

hand (or tool) editing would have worked, too
what you have to do is produce the conflict in the file locally by merging from the master into the working branch first - then the conflict markers and everything will be there

view this post on Zulip Eric Haas (Jun 20 2019 at 23:11):

@Rob I have dealt with conflicts before and this one was a mystery

view this post on Zulip Rob Hausam (Jun 20 2019 at 23:13):

I know - but it ended up being pretty straightforward and could be handled in the usual way(s)

view this post on Zulip Eric Haas (Jun 20 2019 at 23:19):

OK I see what you mean now. thanks


Last updated: Apr 12 2022 at 19:14 UTC