0

I am doing a git merge.

I got two conflicts:

One in spec/controllers/vehicles/vehicle_controller_spec. The other in Gemfile.lock

I resolved the conflict and I see the files I modified which I plan to add and commit.

That is a process I've done many times beforfe without issue.

However this time I see some new files that I've not seen before:

# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       Gemfile.lock.BACKUP.5776.lock
#       Gemfile.lock.BASE.5776.lock
#       Gemfile.lock.LOCAL.5776.lock
#       Gemfile.lock.REMOTE.5776.lock

They seem related to the fact that Gemfile.lock had a conflict but I've never seen this before.

Can I just delete these files?

Coenwulf
  • 1,937
  • 2
  • 15
  • 23
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497

2 Answers2

1

The .lock suffix is purely there because the file with conflicts was itself a .lock file. Those files are created by git mergetool when it's preparing temporary files for use by the merge tool. They are normally cleaned up after the merge tool exits but may be left around if git mergetool is interrupted before the merge tool exits cleanly.

The extension is preserved on the temporary files in case the merge tool wants to use the extension as part of its logic for determining the file type so that it can do things such as the correct syntax highlighting or even sane automatic merging for a given type of file.

CB Bailey
  • 755,051
  • 104
  • 632
  • 656
0

Those files are from resolving the merge, they are copies of the various states of the file for resolving the conflict. If your conflict has been resolved, the files can be deleted.

  • REMOTE - this is the file that was brought in via the merge.
  • LOCAL - this is the file that you had in your local repo
  • BASE - I believe that this file is the state of the file for the last common commit
  • BACKUP - I believe that this file is a copy of the file with the conflicts marked.

These files were created by the tool that you used to resolve the conflict. I personally use vimdiff which results in .swp files being created. Then after the conflicts are resolved, I just delete the files.

Schleis
  • 41,516
  • 7
  • 68
  • 87