qisrc.git – Git related tools

A Pythonic git API


class qisrc.git.Git(repo)

The Git represent a git tree

call(*args, **kwargs)

Call a git command

  • args – The arguments of the command. For instance [“frobnicate”, “–spam=eggs”]
  • kwargs
    Will be passed to subprocess.check_call()
    command, with the following changes:
    • if cwd is not given it will be self.repo instead
    • if env is not given it will be read from the config file
    • if raises is False, no exception will be raise if command fails, and a (retcode, output) tuple will be returned.
clone(*args, **kwargs)

Wrapper for git clone

fetch(*args, **kwargs)

Wrapper for git fetch


Get a git config value. Return None if not found


return the current branch


return the current ref git symbolic-ref HEAD else: git name-rev –name-only –always HEAD


Returns true if working dir is clean. (ie no untracked files, no unstaged changes)

param untracked:
 will return True even if there are untracked files.

Check if the worktree is a valid git tree

pull(*args, **kwargs)

Wrapper for git pull

push(*args, **kwargs)

Wrapper for git push

remote(*args, **kwargs)

Wrapper for git remote

reset(*args, **kwargs)

Wrapper for git reset