2

I'm using revision controlled yaml files to track packages associated with software versions and have multiple jobs (running on Jenkins) editing different parts of the tracking file. When I try to push the changes to the files I sometimes get a merge conflict depending on which part of the file was edited. For example:

HEAD:

...

Package6:
    Name: motorControl
    Version: 1.2
    Size: 341
Package7:
    Name: None
    Version: None
    Size: None
...

Local Copy:

...

Package6:
    Name: None
    Version: None
    Size: None
Package7:
    Name: eyeCandy
    Version: 3.2
    Size: 1087
...

Is there a different merge strategy that I could use to resolve this without needing to manually resolve conflicts?

spizzak
  • 1,087
  • 1
  • 11
  • 17

1 Answers1

2

In your case, the best may be to add this file to .gitignore and not version it. You could then generate it in a git-hooks when you update your files.

If that's not a solution, you can use git checkout --theirs -- <path/file> or git checkout --ours -- <path/file>. Then, you git add and git commit, there's still some step to do manually, but at least you don't need to resolve these conflicts manually in the file.

But the best is really to ignore automatically generated files.

Simon Boudrias
  • 42,953
  • 16
  • 99
  • 134