Proof of concept to explore merge conflict resolution with SOPS encoded files for getsops/sops#52
Here are the steps to try out this repo:
# Clone this repo
git clone https://gist.github.com/962b1eb776ce9947a09d4924d91fd8b2.git gist-sops-merge-conflict
cd gist-sops-merge-conflict
# Install our PGP key
#   Same as https://github.com/mozilla/sops/blob/5bf336baa822821c729278e43440a93816b0d53c/tests/sops_functional_tests_key.asc
gpg --import sops_key.asc
# Append `.gitconfig` to local `.git/config`
cat .gitconfig >> .git/config
# Try out our conflicting branches
git checkout -B conflict first && git checkout master -- sops-mergetool.sh && git reset && git merge second- gitattributes for diff/merge (didn't work out per se)
- git smudge/clean (too git specific, can't handle merge conflicts for MAC/keys)
- Custom mergetool
- git hooks (e.g. victorious-git)
- How do we resolve non-MAC conflicts? (e.g. key rotation)
These are the steps we took to create this repo:
- Installed PGP key: gpg --import sops_key.asc
- Created secret file: sops example.yaml --pgp '1022 470D E3F0 BC54 BC6A B62D E055 50BC 07FB 1A0A- Contents: foo: foo\nbar: bar
 
- Contents: 
- Created 2 conflicting branches:
- git checkout -B first master && sops example.yaml && git add example.yaml && git commit -m "First commit" && git checkout -- Content: foo: baz\nbar: bar
 
- Content: 
- git checkout -B second master && sops example.yaml && git add example.yaml && git commit -m "Second commit" && git checkout -- Content: foo: foo\nbar: baz
 
- Content: 
- Force push branches if necessary git push origin first --force && git push origin second --force
 
- Try out our conflicting branches
- git checkout -B conflict first && git checkout master -- . && git checkout HEAD -- example.yaml && git reset && git merge second
 
Something worth fixing:
In the last command:
Several issues:
conflict firstis not a valid branch name. Trygit checkout -B conflict/firstgit merge secondonly works whensecondwas checked out before, instead, trygit merge origin/secondThanks for this POC.