Skip to content

Instantly share code, notes, and snippets.

@Pictor13
Created January 29, 2015 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pictor13/696ccbff671393e2c912 to your computer and use it in GitHub Desktop.
Save Pictor13/696ccbff671393e2c912 to your computer and use it in GitHub Desktop.
"Compare to Stash..." custom comparision for Sublimerge
# Add the custom comparision "Compare to Stash..." to SublimeMerge plugin
# This allows to compare the current file with the version contained in a stash.
# Custom Comparisions.sublime-settings -- User
{
"custom_comparisons_user": [
{
"name": "Compare to Stash...",
"requires": "git",
"steps": [
{
"quick_panel": {
"name": "get_stash",
"source": {
"execute": {
"command": "{git} stash list",
"directory": "{sublimerge:current_file_dir}"
},
"item": {
"regexp": "^(stash\\@\\{.+\\})(?:\\:\\s+)(.+)$",
"caption": ["@1: @2", "{sublimerge:current_file_name} in @1"],
"value": "@1"
},
"empty_message": "There are no stashes"
}
}
},
{
"define": {
"output_file": "{sublimerge:temp_dir}/{sublimerge:current_file|basename}@stash"
}
},
{
"compare": {
"execute": {
"command": "{git} show {get_stash}:\"./{sublimerge:current_file_name}\" > \"{output_file}\"",
"directory": "{sublimerge:current_file_dir}"
},
"left": {
"title": "{sublimerge:current_file|basename}@{get_stash}",
"file": "{output_file}",
"temporary": true
},
"right": {
"file": "{sublimerge:current_file}",
"temporary": false
}
}
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment