Git
This module provides low-level tools for managing Git repositories. You should normally not use them directly but rather use the high-level wrapper fabtools.require.git.working_copy() instead.
See also
fabtools.require.git
fabtools.git.clone(remote_url, path=None, use_sudo=False, user=None)[source]
Clone a remote Git repository into a new directory.
Parameters: | - remote_url (str) – URL of the remote repository to clone. - path (str) – Path of the working copy directory. Must not exist yet. - use_sudo (bool) – If True execute git with fabric.operations.sudo(), else with fabric.operations.run(). - user (str) – If use_sudo is True, run fabric.operations.sudo() with the given user. If use_sudo is False this parameter has no effect. |
---|---|
fabtools.git.addremote(_path, name, remote_url, use_sudo=False, user=None, fetch=True)[source]
Add a remote Git repository into a directory.
Parameters: | - path (str) – Path of the working copy directory. This directory must exist and be a Git working copy with a default remote to fetch from. - use_sudo (bool) – If True execute git with fabric.operations.sudo(), else with fabric.operations.run(). - user (str) – If use_sudo is True, run fabric.operations.sudo() with the given user. If use_sudo is False this parameter has no effect. - name (str) – name for the remote repository - remote_url (str) – URL of the remote repository - fetch (bool) – If True execute git remote add -f |
---|---|
fabtools.git.fetch(path, use_sudo=False, user=None, remote=None)[source]
Fetch changes from the default remote repository.
This will fetch new changesets, but will not update the contents of the working tree unless yo do a merge or rebase.
Parameters: | - path (str) – Path of the working copy directory. This directory must exist and be a Git working copy with a default remote to fetch from. - use_sudo (bool) – If True execute git with fabric.operations.sudo(), else with fabric.operations.run(). - user (str) – If use_sudo is True, run fabric.operations.sudo() with the given user. If use_sudo is False this parameter has no effect. |
---|---|
fabtools.git.pull(path, use_sudo=False, user=None, force=False)[source]
Fetch changes from the default remote repository and merge them.
Parameters: | - path (str) – Path of the working copy directory. This directory must exist and be a Git working copy with a default remote to pull from. - use_sudo (bool) – If True execute git with fabric.operations.sudo(), else with fabric.operations.run(). - user (str) – If use_sudo is True, run fabric.operations.sudo() with the given user. If use_sudo is False this parameter has no effect. - force (bool) – If True, append the —force option to the command. |
---|---|
fabtools.git.checkout(path, branch=’master’, use_sudo=False, user=None, force=False)[source]
Checkout a branch to the working directory.
Parameters: | - path (str) – Path of the working copy directory. This directory must exist and be a Git working copy. - branch (str) – Name of the branch to checkout. - use_sudo (bool) – If True execute git with fabric.operations.sudo(), else with fabric.operations.run(). - user (str) – If use_sudo is True, run fabric.operations.sudo() with the given user. If use_sudo is False this parameter has no effect. - force (bool) – If True, append the —force option to the command. |
---|---|