git-cli

A small command-line-like Git module for Racket. It invokes the installed git executable and exposes commands both through git and through direct procedures.

(require git-cli)

(git 'status)
(git 'fetch '--prune)
(git 'switch "main")
(git 'restore '--staged "scratch.rkt")
(git 'grep '-i '-n "todo")

(git-status)
(git-current-branch)
(git-branches)
(git-remotes)

git-status returns the index and working-tree status separately:

'((modified unchanged "staged.rkt")
  (unchanged modified "working-tree.rkt")
  (untracked untracked "new.rkt"))

The module also provides a few direct workflows:

(git-save "Implement status parser" "main.rkt" "scribblings/git.scrbl")
(git-save-all "Finish release")
(git-start-branch "feature")
(git-sync)
(git-release 'patch)

git-sync requires a clean working tree and performs pull followed by push. git-release increments info.rkt, commits it, and creates a tag; it does not push automatically.

Git is searched on PATH. If it cannot be found, git-cli asks for the path to git or git.exe and stores it in its simple-ini configuration.

(set-git-config! 'display-output #t)
(set-git-config! 'display-command #f)
(set-git-config! 'tag-prefix "v")

Remote names, upstream branches, pull strategy, credentials and SSH keys remain normal Git configuration.

S
Description
No description provided
Readme MIT 715 KiB
Languages
Racket 99.2%
Makefile 0.8%