jacinle.cli.git#
Utility functions to get git information of the current directory.
Functions
Get the current tracking remote. |
|
|
A utility function to guard the current git repo. |
|
Get the recent logs of the given revision hash. |
|
Get the URL of the remote. |
|
Get the current revision hash. |
|
Get the root directory of the git repo. |
Get the full status of the current git repo. |
|
Get the list of uncommitted files. |
Functions
- git_current_tracking_remote()[source]#
Get the current tracking remote.
- Returns:
the name of the current tracking remote.
- Return type:
- git_guard(force=False)[source]#
A utility function to guard the current git repo. It will check whether there are uncommitted files.
When
force
is False, it will print a warning message including the list of uncommitted files and the diff of the uncommitted files.When
force
is True, it will ask a confirmation from the user. If the user confirms, it will return True. Otherwise, it will terminate the program.
- Parameters:
force (bool)
- git_root()[source]#
Get the root directory of the git repo.
- Returns:
the root directory of the git repo.
- Return type:
- git_status_full()[source]#
Get the full status of the current git repo. This includes the content of the untracked files and the diff of the uncommitted files. Note that when the file is too large (larger than 128 kb), its content will not be shown.
- Returns:
a single string containing the full status of the current git repo.