Last Updated: February 25, 2016
·
1.825K
· deradon

GitFix

Gist:

Link

Simple git-snippet to commit a small fix with auto-generated commit-message.

Description

I noticed, we developers often needs to fix a small typo or do something similiar. And I noticed a lot of Devs, will create awful, or no commit-message at all for these little changes.

So, this little script here, will automatically add files to your index, shows you the generated commit-message and commit if you are fine.

Or you just abort, because you got a idea of a great message!

Usage

git-fix

Installation

Save file to ~/bin/git-fix (may chmod +X it)

Or run:

curl -L "https://gist.github.com/Deradon/4735318/raw/cbf43d10e0f8db8b2ec4d45ddea2ea23c3a50561/git_fix.rb" > ~/bin/git-fix && chmod u+x ~/bin/git-fix

Example

$ git-fix
> git commit -m 'Fixes: Gemfile, Gemfile.lock

 Other files:

 * application_tab_edit_810.css.scss
 * errbit.rb
 * item_wrapper.rb
 * manager_app_helper.rb
 * package.rb
 * routes.rb
 * schema.rb
 * tab_app.rb
 * tabs_controller.rb'

git-fix

6 Responses
Add your response

Hmmm... it seems that your grep is not working!

over 1 year ago ·

@haihappen Wow, ok, I'll have a look at. May you post a sample git status, for that grep does not work the way it should do?

over 1 year ago ·

@deradon I switched to ack (my fork), and now it works perfectly! Thank you for this great little snippet!

over 1 year ago ·

Ah, great. Maybe I should do the RegEx stuff with Ruby, instead of command-line calls.

over 1 year ago ·

@deradon Yap, would make more sense because the rest is already done in Ruby :)

over 1 year ago ·