Skip to content

Instantly share code, notes, and snippets.

View robertsdotpm's full-sized avatar
Back to the OG...

Matthew Roberts robertsdotpm

Back to the OG...
View GitHub Profile
@robertsdotpm
robertsdotpm / resres.py
Created March 13, 2022 18:52
Git merge conflict resolve Python script
Git's merge tool is kind of shitty with respect to rebase. It doesn't seem to acknowledge the working directory? So I made a simple Python script that lets you easily resolve merge conflicts. The diff tool it uses is Visual Studio Code (which is cross-platform.) This was necessary due to Visual Studios merge diffs being read-only.
To use: install the script as /usr/bin/resres, set execute perms, mkdir ~/resres_merge , and on a conflicted file type: resres file.name. This will pop-up a diff view in Visual Studio Code. The changes you want to choose are on the left side split-view.
Once you're done resolving the merge conflict, simply run the tool again on the same file to incorporate your changes. Run the tool multiple times if necessary to resolve all conflicts. It will tell you when you're done.

Keybase proof

I hereby claim:

  • I am robertsdotpm on github.
  • I am robertsdotpm (https://keybase.io/robertsdotpm) on keybase.
  • I have a public key ASDAsqWhui-1Ih6r-SwMYZo1MkXShwdZBq-jR6FjWESqQwo

To claim this, I am signing this object: