|
def | delete (cls, repo, *heads, **kwargs) |
|
def | set_tracking_branch (self, remote_reference) |
|
def | tracking_branch (self) |
|
def | rename (self, new_path, force=False) |
|
def | checkout (self, force=False, **kwargs) |
|
def | config_reader (self) |
|
def | config_writer (self) |
|
def | __init__ (self, repo, path, check_path=True) |
|
def | __str__ (self) |
|
def | set_object (self, object, logmsg=None) |
|
def | name (self) |
|
def | iter_items (cls, repo, common_path=None) |
|
def | remote_name (self) |
|
def | remote_head (self) |
|
def | __init__ (self, repo, path) |
|
def | __repr__ (self) |
|
def | __eq__ (self, other) |
|
def | __ne__ (self, other) |
|
def | __hash__ (self) |
|
def | abspath (self) |
|
def | dereference_recursive (cls, repo, ref_path) |
|
def | set_commit (self, commit, logmsg=None) |
|
def | set_reference (self, ref, logmsg=None) |
|
def | is_valid (self) |
|
def | is_detached (self) |
|
def | log (self) |
|
def | log_append (self, oldbinsha, message, newbinsha=None) |
|
def | log_entry (self, index) |
|
def | to_full_path (cls, path) |
|
def | delete (cls, repo, path) |
|
def | create (cls, repo, path, reference='HEAD', force=False, logmsg=None) |
|
def | from_path (cls, repo, path) |
|
def | is_remote (self) |
|
def | list_items (cls, repo, *args, **kwargs) |
|
def | iter_items (cls, repo, *args, **kwargs) |
|
A Head is a named reference to a Commit. Every Head instance contains a name
and a Commit object.
Examples::
>>> repo = Repo("/path/to/repo")
>>> head = repo.heads[0]
>>> head.name
'master'
>>> head.commit
<git.Commit "1c09f116cbc2cb4100fb6935bb162daa4723f455">
>>> head.commit.hexsha
'1c09f116cbc2cb4100fb6935bb162daa4723f455'
def checkout |
( |
|
self, |
|
|
|
force = False , |
|
|
** |
kwargs |
|
) |
| |
Checkout this head by setting the HEAD to this reference, by updating the index
to reflect the tree we point to and by updating the working tree to reflect
the latest index.
The command will fail if changed working tree files would be overwritten.
:param force:
If True, changes to the index and the working tree will be discarded.
If False, GitCommandError will be raised in that situation.
:param kwargs:
Additional keyword arguments to be passed to git checkout, i.e.
b='new_branch' to create a new branch at the given spot.
:return:
The active branch after the checkout operation, usually self unless
a new branch has been created.
If there is no active branch, as the HEAD is now detached, the HEAD
reference will be returned instead.
:note:
By default it is only allowed to checkout heads - everything else
will leave the HEAD detached which is allowed and possible, but remains
a special state that some tools might not be able to handle.