DEV Community

Erick Navarro
Erick Navarro

Posted on

Interactive commit using terminal

Hello Everybody! My first post here was looking forward to having something adequate to share :)

icommit

I create a simple script for having an interactive commit using the terminal, you can see the instructions here

icommit demo gif

Instructions for icommit

The problem

Usually, a commit will be something like this:

git commit -am 'ADD: new feature'

Then the next commit will be something like this:

git commit -am 'FIX: the feature was broken'

In every commit always the same pattern is repeated git commit -am 'THE_MESSAGE' so I was wondering how to do it faster.

My first attempt was to press up arrow and delete, but it was tedious, then it hit me:

It would be really cool if I could have something like scanner.readline

Like in the text base adventure games, the interaction was basically writing lines, the program read the input and then do something.

So there you have a bonus, now your version control is an adventure game as well!

Top comments (2)

Collapse
 
jessekphillips profile image
Jesse Phillips

My problem is I utilize git gui to break apart my commits but sometimes I want to use commit --fixup so this means staging some changes and jumping to the terminal. If I cared I'd learn to us vim fugitive better.

Collapse
 
cutiko profile image
Erick Navarro

My icommit command is not intended for every situation, neither attempt to replace knowing how to use git. The use case here is editing 1 file at the time.