Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upShould yarn.lock be treated as a binary file in git? #1776
Comments
wyze
added
the
question
label
Nov 10, 2016
This comment has been minimized.
This comment has been minimized.
No it shouldn't. The file is plain text and there can be merge conflicts in the file that you may need to resolve. |
kittens
closed this
Nov 11, 2016
This comment has been minimized.
This comment has been minimized.
MatteoGabriele
commented
Nov 12, 2016
•
In the documentation is written that the yarn.lock file should not be touched to avoid problems and only yarn itself should deal with it. Then how I resolve a merge conflict? |
This comment has been minimized.
This comment has been minimized.
dbashford
commented
Nov 14, 2016
@kittens is the right thing to do when there are conflicts to blow away the lock file and re-run yarn? Seems to me that'd get what you need? |
This comment has been minimized.
This comment has been minimized.
idris
commented
Dec 1, 2016
@dbashford the problem with blowing it away and re-running yarn is that you'll get more changes than you wanted. For example, tilde versions will be upgraded, even though you didn't run |
This comment has been minimized.
This comment has been minimized.
MatteoGabriele
commented
Dec 1, 2016
@dbashford then it's easier to just put the yarn. lock file in the gitignore |
hkrutzer
referenced this issue
Dec 5, 2016
Closed
Deal with lockfile merge conflicts in some way #2155
This comment has been minimized.
This comment has been minimized.
IanVS
commented
Dec 28, 2016
•
The approach that has worked for me so far is this:
When the first conflict arises, I checkout the
This generates a new
And I'm back in business. |
This comment has been minimized.
This comment has been minimized.
ljharb
commented
Dec 28, 2016
Note that even if you're not manually resolving the merge conflicts, having it be a non-binary file means you can see the merge conflicts, which is still valuable information. |
This comment has been minimized.
This comment has been minimized.
mmcgahan
commented
Feb 6, 2017
Related, even if there are no merge conflicts, can we always assume that git has merged two versions of a yarn.lock file in a way that results in a valid/correct file? It seems wrong to let git update the contents of the file at all if yarn is the only tool that is supposed to manage its content. |
This comment has been minimized.
This comment has been minimized.
alexkrolick
commented
Feb 16, 2017
I'm not sure that automerging YAML will always result in a valid file, especially given:
|
This comment has been minimized.
This comment has been minimized.
danny-andrews
commented
Apr 25, 2017
•
This comment has been minimized.
This comment has been minimized.
IanVS
commented
Apr 25, 2017
@danny-andrews can you explain how? |
This comment has been minimized.
This comment has been minimized.
danny-andrews
commented
Apr 25, 2017
When you wipe out |
This comment has been minimized.
This comment has been minimized.
IanVS
commented
Apr 25, 2017
That's why I suggested |
This comment has been minimized.
This comment has been minimized.
idris
commented
Apr 25, 2017
@IanVS yes, that is the correct way to do it. Though I'd recommend |
This comment has been minimized.
This comment has been minimized.
IanVS
commented
Apr 25, 2017
Good point, @idris. I typically rebase onto master, which is the example I used above, but that won't always be the case. |
This comment has been minimized.
This comment has been minimized.
danny-andrews
commented
Apr 25, 2017
•
@IanVS I didn't understand what that command did. That's much better than manually copying and pasting |
This comment has been minimized.
This comment has been minimized.
This is related: #3544 |
This comment has been minimized.
This comment has been minimized.
masaeedu
commented
Jun 23, 2017
Isn't @IanVS's approach compatible with having the lockfile be a binary file? If I understand correctly the idea is to never merge, just throw away what you have and replay your |
AntonNiklasson commentedNov 10, 2016
•
edited
http://stackoverflow.com/questions/40532940/should-yarn-lock-be-treated-as-a-binary-file-in-git[CLOSED]