salt.modules.git

### Navigation

- index
- modules |
- next |
- previous |
- « SaltStack.org |
- Documentation home
- Full list of builtin execution modules »

# salt.modules.git

Support for the Git SCM

`salt.modules.git.` `archive`(cwd, output, rev='HEAD', fmt=None, prefix=None, user=None)

  Export a tarball from the repository

  cwd
    The path to the Git repository
  output
    The path to the archive tarball
  rev: HEAD
    The revision to create an archive from
  fmt: None
    Format of the resulting archive, zip and tar are commonly used
  prefix : None
    Prepend <prefix>/ to every filename in the archive
  user : None
    Run git as a user other than what the minion runs as

  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

  cwd
    The path to the Git repository
  rev
    The remote branch or revision to checkout
  force : False
    Force a checkout even if there might be overwritten changes
  opts : None
    Any additional options to add to the command line
  user : None
    Run git as a user other than what the minion runs as

  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)

  Clone a new repository

  cwd
    The path to the Git repository
  repository
    The git uri of the repository
  opts : None
    Any additional options to add to the command line
  user : None
    Run git as a user other than what the minion runs as

  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.` `describe`(cwd, rev='HEAD', user=None)

  Returns the git describe string (or the SHA hash if there are no tags) for the given revision

  cwd
    The path to the Git repository
  rev: HEAD
    The revision to describe
  user : None
    Run git as a user other than what the minion runs as

  CLI Examples:

      salt '*' git.describe /path/to/repo

      salt '*' git.describe /path/to/repo develop

`salt.modules.git.` `fetch`(cwd, opts=None, user=None)

  Perform a fetch on the given repository

  cwd
    The path to the Git repository
  opts : None
    Any additional options to add to the command line
  user : None
    Run git as a user other than what the minion runs as

  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

  cwd
    The path to the Git repository
  opts : None
    Any additional options to add to the command line
  user : None
    Run git as a user other than what the minion runs as

  CLI Example:

      salt '*' git.init /path/to/repo.git opts='--bare'

`salt.modules.git.` `merge`(cwd, branch='@{upstream}', opts=None, user=None)

  Merge a given branch

  cwd
    The path to the Git repository
  branch : @{upstream}
    The remote branch or revision to merge into the current branch
  opts : None
    Any additional options to add to the command line
  user : None
    Run git as a user other than what the minion runs as

  CLI Example:

      salt '*' git.fetch /path/to/repo
      salt '*' git.merge /path/to/repo @{upstream}

`salt.modules.git.` `pull`(cwd, opts=None, user=None)

  Perform a pull on the given repository

  cwd
    The path to the Git repository
  opts : None
    Any additional options to add to the command line
  user : None
    Run git as a user other than what the minion runs as

  CLI Example:

      salt '*' git.pull /path/to/repo opts='--rebase origin master'

`salt.modules.git.` `rebase`(cwd, rev='master', opts=None, user=None)

  Rebase the current branch

  cwd
    The path to the Git repository
  rev : master
    The revision to rebase onto the current branch
  opts : None
    Any additional options to add to the command line
  user : None
    Run git as a user other than what the minion runs as

  CLI Example:

      salt '*' git.rebase /path/to/repo master

  That is the same as: git rebase 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)

  cwd
    The path to the Git repository
  rev: HEAD
    The revision
  short: False
    Return an abbreviated SHA1 git hash
  user : None
    Run git as a user other than what the minion runs as

  CLI Example:

      salt '*' git.revision /path/to/repo mybranch

`salt.modules.git.` `submodule`(cwd, init=True, opts=None, user=None)

  Initialize git submodules

  cwd
    The path to the Git repository
  init : True
    Ensure that new submodules are initialized
  opts : None
    Any additional options to add to the command line
  user : None
    Run git as a user other than what the minion runs as

## Comments

comments powered by Disqus

### Navigation

- index
- modules |
- next |
- previous |
- « SaltStack.org |
- Documentation home
- Full list of builtin execution modules »