std.lib.git

add

(add arg)(add arg opts)

adds files to the index

(git/add “.”) (git/add {:all true}) (git/add “file1” “file2”)

branch

(branch)(branch name-or-opts)(branch name opts)

branch operations

(git/branch) ;; list branches (git/branch {:root ""}) ;; list branches in repo (git/branch “feature”) ;; create branch (git/branch “feature” {:delete true})

checkout

(checkout branch)(checkout branch opts)

checkouts a branch

(git/checkout “main”) (git/checkout “feature” {:create true})

clone

(clone url)(clone url opts)

clones a git repository

(git/clone “https://github.com/…”) (git/clone “https://github.com/…” {:dir “target”})

commit

(commit arg)(commit msg opts)

commits changes

(git/commit {:message “hello”}) (git/commit “message”)

fetch

(fetch)(fetch opts)

fetches changes

(git/fetch) (git/fetch {:all true})

git

(git args)(git args opts)

generic git command

(git “status”) (git [“commit” “-m” “hello”]) (git “status” {:root “…”})

git-result

(git-result process)

helper to get result from process

git-run

(git-run args)(git-run args opts)

base function for running git commands

init

(init)(init opts)

initializes a git repository

(git/init)

log

(log)(log opts)

returns the git log

(git/log) (git/log {:n 5})

merge-branch

(merge-branch branch)(merge-branch branch opts)

merges a branch

(git/merge-branch “feature”)

pull

(pull)(pull opts)

pulls changes

(git/pull) (git/pull {:rebase true})

push

(push)(push opts)

pushes changes

(git/push) (git/push {:force true})

rebase

(rebase upstream)(rebase upstream opts)

rebases current branch onto upstream AUTO-RECOVERS on failure by aborting.

(git/rebase “origin/main”)

reset

(reset commit)(reset commit opts)

resets the repo

(git/reset “HEAD~1” {:mode :soft})

rev-parse

(rev-parse ref)(rev-parse ref opts)

gets the commit hash

(git/rev-parse “HEAD”)

squash

(squash opts)

squashes the last n commits

(git/squash {:n 3 :message “squashed”})

status

(status)(status opts)

returns the git status as a map

(git/status) => {:branch “main” :changed “file1.txt” :staged “file2.txt”}

submodule

(submodule action)(submodule action opts)

manages submodules

(git/submodule :update) (git/submodule :init) (git/submodule :sync)