sublimehq / sublime_merge

Issue tracker for Sublime Merge
https://www.sublimemerge.com
276 stars 14 forks source link

Autocomplete commit messages after typing "fixup!" #449

Open bfoz opened 5 years ago

bfoz commented 5 years ago

Problem description

When creating a fixup commit one starts by typing the string "fixup!" followed by the first line of the commit to be "fixed", which needs to be typed rather precisely. Sometimes after a long day (the sort of day that causes commits to need fixing) that can be more difficult than might be expected.

Preferred solution

When "fixup" days strike, as they tend to do, it would be handy if Sublime Merge were helpful enough to autocomplete potential commit messages after the user begins a commit message with the string "fixup!".

Alternatives

stinos commented 5 years ago

Better alternative: use an alias like

alias.fixup !sh -c 'git commit -m "fixup! $(git log -1 --format='\''%s'\'' $@)"' -

and add it to the .menu in , passing commit SHA as first argument. I.e. in Commit.sublime-menu:

  {                                                 
    "caption": "fixup",                             
    "command": "git",                               
    "args": {"argv": ["fixup", "$commit"]}          
  }                                               

This is actually faster than your suggestion and requires no typing.

mst-ableton commented 5 years ago

Building off of @stinos's suggestion, you can use git's --fixup option to make it simpler.

I've put the following in Commit.sublime-menu:

[
    {
        "caption": "Create fixup commit for '$short_commit'",
        "command": "git",
        "args": {"argv": ["commit", "--fixup", "$commit"]}
    }
]

Then I can stage something, right-click on a commit and create a fixup commit for it.