A curses git committing utility
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
actions.py
ansi.py
color.py
content_view.py
findg.py
gitco.py
issues.py
menu_view.py
start_app.py

README.md

A curses git committing utility

  • Split panel, one panel display the status of your work tree, what is going to be committed etc..
  • The other panel displays the diff of the selected file
  • Coloured diff
  • Syntax highlight (uses highlight binary)

Wait, but why?

After analysing my git workflow 14 months ago I noticed that most of the time I would call git I would do it in a loop of git status -> git diff -> git add and when I went over all files I would git commit. I made a small tool that went over all the files allowing me to diff, add or skip the file.

The tool was missing the possibility to go back to previous files, adding untracked files, etc... but it saved me a lot of time over the past months.

This is an improved version based on curses that will show the diff immediately on the right part of the screen.

Key bindings

  • Up, down : Select previous/next file
  • j, k: Scroll diff view down/up
  • Home / End or g / G: Go to beginning / end of diff view
  • J / K or npage ppage: Scroll one page down / up in the diff view
  • a: Add the selected file to the index (git add <file>)
  • r: Reset the file (git reset HEAD <file>)
  • c: Checkout the file (git checkout <file>) (CHANGES WILL BE LOST!)
  • e: Edit file
  • Enter: Commit (git commit)
  • q: Quit

File Status

Gitco shows the file's status in git's short-format status. From git docs:

In the short-format, the status of each path is shown as

XY PATH1 -> PATH2

where PATH1 is the path in the HEAD, and the " -> PATH2" part is shown only when PATH1 corresponds to a different path in the index/worktree (i.e. the file is renamed). The XY is a two-letter status code.

For paths with merge conflicts, X and Y show the modification states of each side of the merge. For paths that do not have merge conflicts, X shows the status of the index, and Y shows the status of the work tree. For untracked paths, XY are ??. Other status codes can be interpreted as follows:

  • = unmodified
  • M = modified
  • A = added
  • D = deleted
  • R = renamed
  • C = copied
  • U = updated but unmerged

Ignored files are not listed

X          Y     Meaning
-------------------------------------------------
          [MD]   not updated
M        [ MD]   updated in index
A        [ MD]   added to index
D         [ M]   deleted from index
R        [ MD]   renamed in index
C        [ MD]   copied in index
[MARC]           index and work tree matches
[ MARC]     M    work tree changed since index
[ MARC]     D    deleted in work tree
-------------------------------------------------
D           D    unmerged, both deleted
A           U    unmerged, added by us
U           D    unmerged, deleted by them
U           A    unmerged, added by them
D           U    unmerged, deleted by us
A           A    unmerged, both added
U           U    unmerged, both modified
-------------------------------------------------
?           ?    untracked
!           !    ignored
-------------------------------------------------

Screen shoot

gitco screenshoot