DEV Community

Erick Navarro
Erick Navarro

Posted on

2 1

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!

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

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.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay