gitmopy.git¶
gitmopy’s Git-related utility functions.
Module Contents¶
- class gitmopy.git.CatchRemoteException(remote)[source]¶
Context manager to catch GitCommandError when pushing to a remote.
Also stores whether the issue is that the remote has no upstream branch.
- Parameters:
remote (str) – Name of the remote repository that is being pushed to.
- gitmopy.git.commits_ahead(repo)[source]¶
Get the number of commits the local current branch is behind for each remote.
- Parameters:
repo (Repo) – GitPython repository object.
- Returns:
Number of commits the local current branch is behind for each remote.
- Return type:
- gitmopy.git.commits_behind(repo)[source]¶
Get the number of commits the local current branch is behind for each remote.
- Parameters:
repo (Repo) – GitPython repository object.
- Returns:
Number of commits the local current branch is behind for each remote.
- Return type:
- gitmopy.git.fetch_all(repo)[source]¶
Fetch all remotes of a GitPython repository.
- Parameters:
repo (git.Repo) – Repository to fetch remotes from.
- gitmopy.git.format_remotes_diff(repo)[source]¶
Format the remotes diff.
- Parameters:
repo (Repo) – GitPython repository object.
- Returns:
Formatted remotes diff.
- Return type:
- gitmopy.git.get_files_status(repo)[source]¶
Make a dictionnary of the files’ status in a GitPython repository.
Keys are “staged”, “unstaged” and “untracked”. Values are lists of file paths.
- gitmopy.git.get_staged(repo)[source]¶
Get staged files from a GitPython repository.
- Parameters:
repo (git.Repo) – Repository to get staged files from.
- Returns:
File paths of staged files.
- Return type:
List[str]
- gitmopy.git.get_unstaged(repo)[source]¶
Get unstaged files from a GitPython repository.
- Parameters:
repo (git.Repo) – Repository to get unstaged files from.
- Returns:
File paths of unstaged files.
- Return type:
List[str]
- gitmopy.git.get_untracked(repo)[source]¶
Get untracked files from a GitPython repository.
- Parameters:
repo (git.Repo) – Repository to get untracked files from.
- Returns:
File paths of untracked files.
- Return type:
List[str]