Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

I've been using Git on Windows (msysgit) to track changes for some design work I've been doing.

Today I've been working on a different PC (with remote repo brian) and I'm now trying to merge the edits done today back into my regular local version on my laptop.

On my laptop, I've used git pull brian master to pull the changes into my local version. Everything was fine apart from the main InDesign document - this shows as a conflict.

The version on the PC (brian) is the latest one that I want to keep but I don't know what commands tell the repo to use this one.

I tried directly copying the file across onto my laptop but this seems to break the whole merge process.

Can anyone point me in the right direction?

1 Answer

0 votes
by (50.2k points)

For cases like this git checkout accepts an --ours or --theirs option. 

So if you have a merge conflict, and you just want the file from the branch you are merging in, you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt

To use that version of the file. Likewise, if you know you want your version you can use

$ git checkout --ours -- path/to/conflicted-file.txt

Reference: https://git-scm.com/docs/git-checkout#Documentation/git-checkout.txt---ours

Browse Categories

...