Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a proposal for a subcommand to make merge conflicts easier to resolve.
Merge conflicts result in yaml files which have git conflict markers interspersed throughout:
Attempting to edit this file without sops will result in mac mismatch errors for obvious reasons. Unfortunately, sops is unable to interpret these files:
The current workflow I have for handling merge conflicts is to check out the file from both branches, decrypt it, diff it, make my changes, and then reencrypt it. This works but it's rather annoying.
Git has a very cool feature called git-mergetool which does the work of checking out the two branches and replacing the original file once the conflict is resolved for us. We can use
git mergetool
to invoke sops, sops can decrypt the files and handle our merge, and then reencrypt it once we're done.Right now I have this working as a proof of concept with vim, similar to how
git config merge.tool vimdiff
works. By setting the following in your .git/config you can invokegit mergetool
which will give you a lovely vim window to resolve your changesAnything in the pane at the bottom will be encrypted with sops before replacing the conflicted file. This allows for easy resolution of merge conflicts without requiring anything funky with
--ignore-mac
.I've included positional arguments in the
mergetool
command which should allow other editors such as kdiff3 or meld but I haven't tested it. Invocation would be something likesops mergetool kdiff3 {base} {local} {remote} -o {merged}
I've got quite a bit of code cleanup and refactoring to do but I wanted to get some feedback on this proposed feature first.