How to override unclaimed git check with upstream version

I am trying to revert a locally modified file to the version that is the most recent version up, effectively undoing my changes.

$ git checkout -- Jovie/Jovie-Info.plist error: path 'Jovie/Jovie-Info.plist' is unmerged 

Using -f changes the error for warning, but still will not make the change (???)

 $ git checkout -f -- Jovie/Jovie-Info.plist warning: path 'Jovie/Jovie-Info.plist' is unmerged 

The file itself is as follows:

 $ git diff Jovie/Jovie-Info.plist diff --cc Jovie/Jovie-Info.plist index 6c576d9,0209baa..0000000 --- a/Jovie/Jovie-Info.plist +++ b/Jovie/Jovie-Info.plist @@@ -50,7 -50,7 +50,11 @@@ </dict> </array> <key>CFBundleVersion</key> ++<<<<<<< Updated upstream + <string>5922</string> ++======= + <string>5918</string> ++>>>>>>> Stashed changes <key>Fabric</key> <dict> <key>APIKey</key> 

How to override local files and apply upstream changes?

+5
source share
2 answers

You may need to reset the file first before doing the check:

 git reset -- Jovie/Jovie-Info.plist git checkout -- Jovie/Jovie-Info.plist 

reset un-stage changes in the process (here merge, with conflict markers in the file).
Validation can then restore the index with the latest commit content.

+15
source

If you need to do for all modified unrelated files, there is an easy way to do this, and not do for each of them:

 git reset $( git status | grep both | awk '{print $4}') git checkout $( git status | grep modified | awk '{print $3}') 

If you need to make unrelated files for all [added / deleted] by us , there is an easy way to do this, and not to do for each of them:

 git reset $( git status | grep us | awk '{print $5}') git checkout $( git status | grep modified | awk '{print $3}') 

If you need to make unrelated files for all [added / deleted] by them , there is an easy way to do this, and not do for each of them:

 git reset $( git status | grep them | awk '{print $5}') git checkout $( git status | grep modified | awk '{print $3}') 
+4
source

Source: https://habr.com/ru/post/1207523/


All Articles