Support for the Git SCM
salt.modules.git.add(cwd, file_name, user=None, opts=None)¶add a file to git
CLI Example:
salt '*' git.add /path/to/git/repo /path/to/file
salt.modules.git.archive(cwd, output, rev='HEAD', fmt=None, prefix=None, user=None)¶Export a tarball from the repository
If prefix is not specified it defaults to the basename of the repo
directory.
CLI Example:
salt '*' git.archive /path/to/repo /path/to/archive.tar.gz
salt.modules.git.checkout(cwd, rev, force=False, opts=None, user=None)¶Checkout a given revision
CLI Examples:
salt '*' git.checkout /path/to/repo somebranch user=jeff
salt '*' git.checkout /path/to/repo opts='testbranch -- conf/file1 file2'
salt '*' git.checkout /path/to/repo rev=origin/mybranch opts=--track
salt.modules.git.clone(cwd, repository, opts=None, user=None, identity=None)¶Clone a new repository
CLI Example:
salt '*' git.clone /path/to/repo git://github.com/saltstack/salt.git
salt '*' git.clone /path/to/repo.git\
git://github.com/saltstack/salt.git '--bare --origin github'
salt.modules.git.commit(cwd, message, user=None, opts=None)¶create a commit
CLI Example:
salt '*' git.commit /path/to/git/repo 'The commit message'
salt.modules.git.config_get(cwd, setting_name, user=None)¶Get a key from the git configuration file (.git/config) of the repository.
CLI Example:
salt '*' git.config_get /path/to/repo user.email
salt.modules.git.config_set(cwd, setting_name, setting_value, user=None, is_global=False)¶Set a key in the git configuration file (.git/config) of the repository or globally.
CLI Example:
salt '*' git.config_set /path/to/repo user.email me@example.com
salt.modules.git.current_branch(cwd, user=None)¶Returns the current branch name, if on a branch.
CLI Example:
salt '*' git.current_branch /path/to/repo
salt.modules.git.describe(cwd, rev='HEAD', user=None)¶Returns the git describe string (or the SHA hash if there are no tags) for the given revision
CLI Examples:
salt '*' git.describe /path/to/repo
salt '*' git.describe /path/to/repo develop
salt.modules.git.fetch(cwd, opts=None, user=None, identity=None)¶Perform a fetch on the given repository
CLI Example:
salt '*' git.fetch /path/to/repo '--all'
salt '*' git.fetch cwd=/path/to/repo opts='--all' user=johnny
salt.modules.git.init(cwd, opts=None, user=None)¶Initialize a new git repository
CLI Example:
salt '*' git.init /path/to/repo.git opts='--bare'
salt.modules.git.ls_remote(cwd, repository='origin', branch='master', user=None, identity=None)¶Returns the upstream hash for any given URL and branch.
CLI Example:
salt '*' git.ls_remote /pat/to/repo origin master
salt.modules.git.merge(cwd, branch='@{upstream}', opts=None, user=None)¶Merge a given branch
CLI Example:
salt '*' git.fetch /path/to/repo
salt '*' git.merge /path/to/repo @{upstream}
salt.modules.git.pull(cwd, opts=None, user=None, identity=None)¶Perform a pull on the given repository
CLI Example:
salt '*' git.pull /path/to/repo opts='--rebase origin master'
salt.modules.git.push(cwd, remote_name, branch='master', user=None, opts=None, identity=None)¶Push to remote
CLI Example:
salt '*' git.push /path/to/git/repo remote-name
salt.modules.git.rebase(cwd, rev='master', opts=None, user=None)¶Rebase the current branch
CLI Example:
salt '*' git.rebase /path/to/repo master
salt '*' git.rebase /path/to/repo 'origin master'
That is the same as:
git rebase master
git rebase origin master
salt.modules.git.remote_get(cwd, remote='origin', user=None)¶get the fetch and push URL for a specified remote name
CLI Example:
salt '*' git.remote_get /path/to/repo
salt '*' git.remote_get /path/to/repo upstream
salt.modules.git.remote_set(cwd, name='origin', url=None, user=None)¶sets a remote with name and URL like git remote add <remote_name> <remote_url>
CLI Example:
salt '*' git.remote_set /path/to/repo remote_url=git@github.com:saltstack/salt.git
salt '*' git.remote_set /path/to/repo origin git@github.com:saltstack/salt.git
salt.modules.git.remotes(cwd, user=None)¶Get remotes like git remote -v
CLI Example:
salt '*' git.remotes /path/to/repo
salt.modules.git.reset(cwd, opts=None, user=None)¶Reset the repository checkout
CLI Example:
salt '*' git.reset /path/to/repo master
salt.modules.git.revision(cwd, rev='HEAD', short=False, user=None)¶Returns the long hash of a given identifier (hash, branch, tag, HEAD, etc)
CLI Example:
salt '*' git.revision /path/to/repo mybranch
salt.modules.git.rm(cwd, file_name, user=None, opts=None)¶Remove a file from git
CLI Example:
salt '*' git.rm /path/to/git/repo /path/to/file
salt.modules.git.stash(cwd, opts=None, user=None)¶Stash changes in the repository checkout
CLI Example:
salt '*' git.stash /path/to/repo master
salt.modules.git.status(cwd, user=None)¶Return the status of the repository. The returned format uses the status codes of gits 'porcelain' output mode
CLI Example:
salt '*' git.status /path/to/git/repo
salt.modules.git.submodule(cwd, init=True, opts=None, user=None, identity=None)¶Initialize git submodules
CLI Example:
salt '*' git.submodule /path/to/repo.git/sub/repo
Current Salt release: 2014.1.7
Docs for previous releases on salt.rtfd.org.