Support for the Git SCM
add a file to git
CLI Example:
salt '*' git.add /path/to/git/repo /path/to/file
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
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
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'
create a commit
CLI Example:
salt '*' git.commit /path/to/git/repo 'The commit message'
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
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
Initialize a new git repository
CLI Example:
salt '*' git.init /path/to/repo.git opts='--bare'
Merge a given branch
CLI Example:
salt '*' git.fetch /path/to/repo
salt '*' git.merge /path/to/repo @{upstream}
Perform a pull on the given repository
CLI Example:
salt '*' git.pull /path/to/repo opts='--rebase origin master'
Push to remote
CLI Example:
salt '*' git.push /path/to/git/repo remote-name
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
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
sets a remote with name and URL like git remote add <remote_name> <remote_url>
CLI Example:
salt '*' git.remote_set /path/to/repo [email protected]:saltstack/salt.git
salt '*' git.remote_set /path/to/repo origin [email protected]:saltstack/salt.git
Get remotes like git remote -v
CLI Example:
salt '*' git.remotes /path/to/repo
Reset the repository checkout
CLI Example:
salt '*' git.reset /path/to/repo master
Returns the long hash of a given identifier (hash, branch, tag, HEAD, etc)
CLI Example:
salt '*' git.revision /path/to/repo mybranch
Remove a file from git
CLI Example:
salt '*' git.rm /path/to/git/repo /path/to/file
Stash changes in the repository checkout
CLI Example:
salt '*' git.stash /path/to/repo master
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
Initialize git submodules
CLI Example:
salt '*' git.submodule /path/to/repo.git/sub/repo