Expand description
Git repository utilities.
Thin wrappers around git CLI commands and .gitignore file manipulation.
All functions that shell out to git gracefully return false or an error
if git is not installed or the current directory is not a repository.
§Future work
- Replace CLI shelling with the
git2crate for faster, dependency-free operation (no requirement for git to be in$PATH). - Add
staged_files()to list files currently in the git index. - Add
last_commit_touching(file)for the doctor command to surface when a.envfile was last accidentally committed.
Functions§
- add_
to_ gitignore - Append
fileto.gitignore, creating it if necessary. - current_
branch - Return the name of the current git branch.
- is_
clean - Return
trueif the working directory has no uncommitted changes. - is_
in_ gitignore - Return
trueiffileis listed in.gitignore. - is_
tracked - Return
trueiffileis tracked by the Git index. - scan_
history - Search git history for commits that introduced
pattern.