Kerem atam
Kerem atam

Reputation: 2797

Resolve conflict between two files that not in a git repository

I like git's way of resolving conflict and I wanna use it for two versions of an arbitrary file, that are not in a repository. Any suggestion about what could be the approach?

Upvotes: 0

Views: 125

Answers (1)

LeGEC
LeGEC

Reputation: 52226

If you want to partially transform the content of thefile from A to B, you can maybe take advantage of git add -p which runs from the command line :

  • create an empty repository
  • create a commit with thefile having content A
  • copy thefile with content B into the repo
  • use git add -p to have the interactive command line interface to stage the diff chunk by chunk
  • once you are satisfied with the staged content, commit, and discard the other changes

a technical note : for a merge git actually has 3 files : ours, theirs and base. A conflict can arise when a patch (the diff between two files: base and theirs) tries to apply a diff in a position where the file has already changed in the 3rd file (ours).

Upvotes: 1

Related Questions