Skip to main content

Module git

Module git 

Source
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 git2 crate 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 .env file was last accidentally committed.

Functions§

add_to_gitignore
Append file to .gitignore, creating it if necessary.
current_branch
Return the name of the current git branch.
is_clean
Return true if the working directory has no uncommitted changes.
is_in_gitignore
Return true if file is listed in .gitignore.
is_tracked
Return true if file is tracked by the Git index.
scan_history
Search git history for commits that introduced pattern.