Ggit.Repository¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37), Gio.Initable (2) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | clone(url, location, options) | 
| class | discover(location) | 
| class | discover_full(location, across_fs, ceiling_dirs) | 
| class | init_repository(location, is_bare) | 
| class | open(location) | 
| add_remote_fetch(remote, refspec) | |
| add_remote_push(remote, refspec) | |
| blame_file(file, blame_options) | |
| checkout_head(options) | |
| checkout_index(index, options) | |
| checkout_tree(tree, options) | |
| cherry_pick(commit, options) | |
| cherry_pick_commit(commit, our_commit, mainline, merge_options) | |
| create_blob() | |
| create_blob_from_buffer(buffer) | |
| create_blob_from_file(file) | |
| create_blob_from_path(path) | |
| create_branch(branch_name, target, flags) | |
| create_commit(update_ref, author, committer, message_encoding, message, tree, parents) | |
| create_commit_from_ids(update_ref, author, committer, message_encoding, message, tree, parents) | |
| create_index_entry_for_file(file, id) | |
| create_index_entry_for_path(path, id) | |
| create_note(notes_ref, author, committer, id, note, force) | |
| create_reference(name, oid, log_message) | |
| create_remote(name, url) | |
| create_symbolic_reference(name, target, log_message) | |
| create_tag(tag_name, target, tagger, message, flags) | |
| create_tag_annotation(tag_name, target, signature, message) | |
| create_tag_from_buffer(tag, flags) | |
| create_tag_lightweight(tag_name, target, flags) | |
| create_tree_builder() | |
| create_tree_builder_from_tree(tree) | |
| delete_tag(name) | |
| drop_stash(index) | |
| enumerate_branches(list_type) | |
| file_status(location) | |
| file_status_foreach(options, callback, *user_data) | |
| get_ahead_behind(local, upstream) | |
| get_attribute(path, name, flags) | |
| get_config() | |
| get_default_notes_ref() | |
| get_descendant_of(commit, ancestor) | |
| get_head() | |
| get_index() | |
| get_location() | |
| get_submodule_status(name, ignore) | |
| get_workdir() | |
| is_bare() | |
| is_empty() | |
| is_head_detached() | |
| is_head_unborn() | |
| list_remotes() | |
| list_tags() | |
| list_tags_match(pattern) | |
| lookup(oid, gtype) | |
| lookup_blob(oid) | |
| lookup_branch(branch_name, branch_type) | |
| lookup_commit(oid) | |
| lookup_reference(name) | |
| lookup_reference_dwim(short_name) | |
| lookup_remote(name) | |
| lookup_submodule(name) | |
| lookup_tag(oid) | |
| lookup_tree(oid) | |
| merge(their_heads, merge_opts, checkout_opts) | |
| merge_base(oid_one, oid_two) | |
| merge_commits(our_commit, their_commit, merge_options) | |
| merge_trees(ancestor_tree, our_tree, their_tree, merge_options) | |
| note_foreach(notes_ref, callback, *user_data) | |
| path_is_ignored(path) | |
| read_note(notes_ref, id) | |
| rebase_init(branch, upstream, onto, options) | |
| rebase_open(options) | |
| references_foreach(callback, *user_data) | |
| references_foreach_name(callback, *user_data) | |
| remove_note(notes_ref, author, committer, id) | |
| remove_remote(name) | |
| rename_remote(name, new_name) | |
| reset(target, reset_type, checkout_options) | |
| reset_default(target, pathspecs) | |
| revert(commit, options) | |
| revparse(spec) | |
| save_stash(stasher, message, flags) | |
| set_head(ref_name) | |
| set_remote_url(remote, url) | |
| set_submodule_fetch_recurse(name, fetch_recurse_submodules) | |
| set_submodule_ignore(name, ignore) | |
| set_submodule_update(name, update) | |
| set_submodule_url(name, url) | |
| set_workdir(workdir, update_gitlink) | |
| stash_foreach(callback, *user_data) | |
| submodule_foreach(callback, *user_data) | |
| tag_foreach(callback, *user_data) | 
Virtual Methods¶
| Inherited: | GObject.Object (7), Gio.Initable (1) | 
|---|
Properties¶
| Inherited: | Ggit.Native (1) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| clone-options | Ggit.CloneOptions | r/w/co | Clone options | 
| head | Ggit.Ref | r | Head | 
| init | bool | r/w/co | Whether to initialize a repository | 
| is-bare | bool | r/w/co | Is a bare repository | 
| location | Gio.File | r/w/co | The location of the repository | 
| url | str | r/w/co | The URL for cloning a repository | 
| workdir | Gio.File | r/w/c | The path to the repository working directory | 
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class Ggit.Repository(**kwargs)¶
- Bases: - Ggit.Native,- Gio.Initable- Abstract: - No - Structure: - Ggit.RepositoryClass- Represents an existing git repository including all of it’s object contents. - 
classmethod clone(url, location, options)¶
- Parameters: - url (str) – url to fetch the repository from.
- location (Gio.File) – the location of the repository.
- options (Ggit.CloneOptionsorNone) – aGgit.CloneOptions.
 - Raises: - Returns: - a newly created - Ggit.Repository.- Return type: - Clones a new git repository in the given folder. 
- url (
 - 
classmethod discover(location)¶
- Parameters: - location ( - Gio.File) – the base location where the lookup starts.- Raises: - GLib.Error- Returns: - the repository location. - Return type: - Gio.Fileor- None- Looks for a git repository. - The lookup starts from path and walks up the parent directories and stops when a repository is found. 
 - 
classmethod discover_full(location, across_fs, ceiling_dirs)¶
- Parameters: - Raises: - Returns: - the repository location. - Return type: - Looks for a git repository. - The lookup starts from path and walks up the parent directories and stops when a repository is found. 
 - 
classmethod init_repository(location, is_bare)¶
- Parameters: - Raises: - Returns: - a newly created - Ggit.Repository.- Return type: - Creates a new git repository in the given folder. 
 - 
classmethod open(location)¶
- Parameters: - location ( - Gio.File) – the location of the repository.- Raises: - GLib.Error- Returns: - a newly created - Ggit.Repository.- Return type: - Ggit.Repositoryor- None- Open a git repository. - The path must point to an existing git repository folder, e.g. - /path/to/my_repo/.git/ (normal repository) objects/ index HEAD - /path/to/bare_repo/ (bare repository) objects/ index HEAD - The method will automatically detect if path is a normal or bare repository or fail if it is neither. 
 - 
add_remote_fetch(remote, refspec)¶
- Parameters: - remote (Ggit.Remote) – aGgit.Remote.
- refspec (str) – the fetch refspec.
 - Raises: - Adds a fetch refspec to the remote’s configuration. Adds refspec to the fetch list in the configuration. No loaded remote instances will be affected. 
- remote (
 - 
add_remote_push(remote, refspec)¶
- Parameters: - remote (Ggit.Remote) – aGgit.Remote.
- refspec (str) – the push refspec.
 - Raises: - Adds a push refspec to remote’s configuration. Adds the given refspec to the push list in the configuration. No loaded remote instances will be affected. 
- remote (
 - 
blame_file(file, blame_options)¶
- Parameters: - file (Gio.File) – the file to blame.
- blame_options (Ggit.BlameOptionsorNone) – blame options.
 - Raises: - Returns: - a - Ggit.Blame.- Return type: - Ggit.Blameor- None- Get a blame for a single file. 
- file (
 - 
checkout_head(options)¶
- Parameters: - options ( - Ggit.CheckoutOptionsor- None) – a- Ggit.CheckoutOptionsor- None.- Raises: - GLib.Error- Returns: - Trueif the checkout was successfull,- Falseotherwise.- Return type: - bool- Update files in the working tree to reflect the contents of current HEAD. If options is - None, then the default checkout options will be used.- If the checkout was not successfull, then error will be set. 
 - 
checkout_index(index, options)¶
- Parameters: - index (Ggit.IndexorNone) – aGgit.IndexorNone.
- options (Ggit.CheckoutOptionsorNone) – aGgit.CheckoutOptionsorNone.
 - Raises: - Returns: - Return type: - Update files in the working tree to reflect the contents of the index. If index is - None, then the current index of the repository will be used. If options is- None, then the default checkout options will be used.- If the checkout was not successfull, then error will be set. 
- index (
 - 
checkout_tree(tree, options)¶
- Parameters: - tree (Ggit.ObjectorNone) – aGgit.ObjectorNone.
- options (Ggit.CheckoutOptionsorNone) – aGgit.CheckoutOptionsorNone.
 - Raises: - Returns: - Return type: - Update files in the working tree to reflect the contents of the specified commit, tag or tree object. If tree is - None, then the current HEAD of the repository will be used. If options is- None, then the default checkout options will be used.- If the checkout was not successfull, then error will be set. 
- tree (
 - 
cherry_pick(commit, options)¶
- Parameters: - commit (Ggit.Commit) – aGgit.Commit.
- options (Ggit.CherryPickOptions) – aGgit.CherryPickOptions.
 - Raises: - Returns: - Trueif the commit was cherry-picked successfully,- Falseotherwise.- Return type: - Cherry pick the specified commit, making changes in the index and the working directory. 
- commit (
 - 
cherry_pick_commit(commit, our_commit, mainline, merge_options)¶
- Parameters: - commit (Ggit.Commit) – aGgit.Committo cherry-pick.
- our_commit (Ggit.Commit) – aGgit.Committo cherry-pick on.
- mainline (int) – the parent of the commit, in case of a merge commit.
- merge_options (Ggit.MergeOptionsorNone) – aGgit.MergeOptions.
 - Raises: - Returns: - a - Ggit.Index.- Return type: - Ggit.Indexor- None- Cherry-picks the given commit against the provided our_commit, producing and index that reflects the result of the cherry-pick. 
- commit (
 - 
create_blob()¶
- Returns: - a - Ggit.BlobOutputStream.- Return type: - Ggit.BlobOutputStreamor- None- Create a new blob and return a - Gio.OutputStreamto write contents to the blob. This is an efficient way to create new blobs without copying data. The blob id can be obtained from the blob output stream using- Ggit.BlobOutputStream.get_id, after you close the stream.
 - 
create_blob_from_buffer(buffer)¶
- Parameters: - buffer ( - bytes) – the data.- Raises: - GLib.Error- Returns: - the new #GgitOid of the written blob, or - Noneif writing the blob failed.- Return type: - Ggit.OIdor- None- Write an in-memory buffer to the object database as a blob. 
 - 
create_blob_from_file(file)¶
- Parameters: - file ( - Gio.File) – a- Gio.File.- Raises: - GLib.Error- Return type: - Ggit.OId- Write a file to the object database as a blob. - Returns (transfer full) (nullable): the new #GgitOid of the written blob, or - Noneif writing the blob failed.
 - 
create_blob_from_path(path)¶
- Parameters: - path ( - str) – the file path.- Raises: - GLib.Error- Returns: - the new #GgitOid of the written blob, or - Noneif writing the blob failed.- Return type: - Ggit.OIdor- None- Write a path relative to the repository working directory to the object database as a blob. 
 - 
create_branch(branch_name, target, flags)¶
- Parameters: - branch_name (str) – the name of the branch.
- target (Ggit.Object) – aGgit.Object.
- flags (Ggit.CreateFlags) – aGgit.CreateFlags.
 - Raises: - Returns: - the reference to which the branch points, or - Nonein case of an error.- Return type: - Ggit.Branchor- None- Creates a new branch pointing at a target commit. 
- branch_name (
 - 
create_commit(update_ref, author, committer, message_encoding, message, tree, parents)¶
- Parameters: - update_ref (strorNone) – name of the reference to update.
- author (Ggit.Signature) – author signature.
- committer (Ggit.Signature) – committer signature (and time of commit).
- message_encoding (strorNone) – message encoding.
- message (str) – commit message.
- tree (Ggit.Tree) – the tree of objects to commit.
- parents ([Ggit.Commit]) – parent commits.
 - Raises: - Returns: - the - Ggit.OIdof the created commit object, or- Nonein case of an error.- Return type: - Create a new commit. If update_ref is not - None, the given reference will be updated to point to the newly created commit. Use “HEAD” to update the HEAD of the current branch and make it point to this commit.- If message_encoding is set to - None, “UTF-8” encoding is assumed for the provided message. Note that message will not be cleaned up automatically. You can use- Ggit.message_prettifyto do this yourself if needed.
- update_ref (
 - 
create_commit_from_ids(update_ref, author, committer, message_encoding, message, tree, parents)¶
- Parameters: - update_ref (strorNone) – name of the reference to update.
- author (Ggit.Signature) – author signature.
- committer (Ggit.Signature) – committer signature (and time of commit).
- message_encoding (strorNone) – message encoding.
- message (str) – commit message.
- tree (Ggit.OId) – the tree of objects to commit.
- parents ([Ggit.OId]) – parent commits.
 - Raises: - Returns: - the - Ggit.OIdof the created commit object, or- Nonein case of an error.- Return type: - Create a new commit. If update_ref is not - None, the given reference will be updated to point to the newly created commit. Use “HEAD” to update the HEAD of the current branch and make it point to this commit.- If message_encoding is set to - None, “UTF-8” encoding is assumed for the provided message. Note that message will not be cleaned up automatically. You can use- Ggit.message_prettifyto do this yourself if needed.
- update_ref (
 - 
create_index_entry_for_file(file, id)¶
- Parameters: - Raises: - Returns: - a - Ggit.IndexEntryor- Nonewhen an error occurred.- Return type: - Create a new index entry. When file is not - None, the path of the returned entry (- Ggit.IndexEntry.get_path) is set to the path of file relative to the working directory of self. The file must reside in the working directory of self. The file related fields of the returned entry are also queried from this file (if the file exists).- If id is not - None, then the id of the returned entry is set to id (see- Ggit.IndexEntry.get_id) which could point to a blob (for a file) or a tree (for a directory).
 - 
create_index_entry_for_path(path, id)¶
- Parameters: - Raises: - Returns: - a - Ggit.IndexEntryor- Nonewhen an error occurred.- Return type: - Create a new index entry. When path is not - None, the path of the returned entry (- Ggit.IndexEntry.get_path) is set to path. The specified path can be either absolute or relative. In the case of an absolute path, the path must reside within the working directory of self. The file related fields of the returned entry are also queried from this path (if the file exists).- If id is not - None, then the id of the returned entry is set to id (see- Ggit.IndexEntry.get_id) which could point to a blob (for a file) or a tree (for a directory).
 - 
create_note(notes_ref, author, committer, id, note, force)¶
- Parameters: - notes_ref (strorNone) – canonical name of the reference to use, orNoneto use the default ref.
- author (Ggit.Signature) – author signature.
- committer (Ggit.Signature) – committer signature.
- id (Ggit.OId) – OID of the git object to decorate.
- note (str) – content of the note to add for object oid.
- force (bool) – whether to overwrite existing note.
 - Raises: - Returns: - the OID for the note or - Nonein case of error.- Return type: - Adds a note for an object. 
- notes_ref (
 - 
create_reference(name, oid, log_message)¶
- Parameters: - Raises: - Returns: - the newly created reference. - Return type: - Creates a new object id reference. - The reference will be created in the repository and written to the disk. The returned value must be freed with - GObject.Object.unref().
 - 
create_remote(name, url)¶
- Parameters: - Raises: - Returns: - a new - Ggit.Remoteor- Noneif there is an error.- Return type: - Ggit.Remoteor- None- Adds a remote with the default fetch refspec to the repository’s configuration. 
 - 
create_symbolic_reference(name, target, log_message)¶
- Parameters: - Raises: - Returns: - the newly created reference. - Return type: - Creates a new symbolic reference. - The reference will be created in the repository and written to the disk. The returned value must be freed with - GObject.Object.unref().
 - 
create_tag(tag_name, target, tagger, message, flags)¶
- Parameters: - tag_name (str) – the tag name.
- target (Ggit.Object) – aGgit.Object.
- tagger (Ggit.Signature) – aGgit.Signature.
- message (str) – the tag message.
- flags (Ggit.CreateFlags) – aGgit.CreateFlags.
 - Raises: - Returns: - the id to which the tag points, or - Nonein case of an error.- Return type: - Create a new tag object. 
- tag_name (
 - 
create_tag_annotation(tag_name, target, signature, message)¶
- Parameters: - tag_name (str) – the name of the tag.
- target (Ggit.Object) – aGgit.Object.
- signature (Ggit.Signature) – aGgit.Object.
- message (str) – the tag message.
 - Raises: - Returns: - the id to which the tag points, or - Nonein case of an error.- Return type: - Creates a new annotated tag. 
- tag_name (
 - 
create_tag_from_buffer(tag, flags)¶
- Parameters: - tag (str) – the tag buffer.
- flags (Ggit.CreateFlags) – aGgit.CreateFlags.
 - Raises: - Returns: - the id to which the tag points, or - Nonein case of an error.- Return type: - Create a new tag from a buffer describing the tag object. The buffer must be correctly formatted. 
- tag (
 - 
create_tag_lightweight(tag_name, target, flags)¶
- Parameters: - tag_name (str) – the name of the tag.
- target (Ggit.Object) – aGgit.Object.
- flags (Ggit.CreateFlags) – aGgit.CreateFlags.
 - Raises: - Returns: - the id to which the tag points, or - Nonein case of an error.- Return type: - Creates a new lightweight tag. 
- tag_name (
 - 
create_tree_builder()¶
- Raises: - GLib.Error- Returns: - a new - Ggit.TreeBuilder, or- Noneif there was an error.- Return type: - Ggit.TreeBuilderor- None- Create a new tree builder. 
 - 
create_tree_builder_from_tree(tree)¶
- Parameters: - tree ( - Ggit.Tree) – a- Ggit.Tree.- Raises: - GLib.Error- Returns: - a new - Ggit.TreeBuilderobject, or- Noneif there was an error.- Return type: - Ggit.TreeBuilderor- None- Create a tree builder for initialized with tree. To create an empty tree builder, use - Ggit.Repository.create_tree_builderinstead.
 - 
delete_tag(name)¶
- Parameters: - name ( - str) – the name of the tag.- Raises: - GLib.Error- Returns: - Trueif the tag was deleted successfully,- Falseotherwise.- Return type: - bool- Delete an existing tag reference by name. 
 - 
drop_stash(index)¶
- Parameters: - index ( - int) – the position within the stash list. 0 points to the. most recent stashed state.- Raises: - GLib.Error- Removes a single stashed state from the stash list. 
 - 
enumerate_branches(list_type)¶
- Parameters: - list_type ( - Ggit.BranchType) – a- Ggit.BranchType.- Raises: - GLib.Error- Returns: - a branch enumerator. - Return type: - Ggit.BranchEnumeratoror- None- Get a branch enumerator to enumerate over all branches of the specified list_type in self. 
 - 
file_status(location)¶
- Parameters: - location ( - Gio.File) – the file to retrieve status for, rooted at the repository working dir.- Raises: - GLib.Error- Returns: - the status for a single file. - Return type: - Ggit.StatusFlags- Gets the file status for a single file. 
 - 
file_status_foreach(options, callback, *user_data)¶
- Parameters: - options (Ggit.StatusOptionsorNone) – status options, orNone.
- callback (Ggit.StatusCallback) – aGgit.StatusCallback.
- user_data (objectorNone) – callback user data.
 - Raises: - Returns: - Return type: - Gathers file statuses and run a callback for each one. - To the callback is passed the path of the file, the status and the data pointer passed to this function. If the callback returns something other than 0, the iteration will stop and error will be set. - Set options to - Noneto get the default status options.
- options (
 - 
get_ahead_behind(local, upstream)¶
- Parameters: - Raises: - Returns: - ahead: - number of unique from commits in upstream. - behind: - number of unique from commits in local. - Return type: - Count the number of unique commits between two commit objects. - There is no need for branches containing the commits to have any upstream relationship, but it helps to think of one as a branch and the other as its upstream, the ahead and behind values will be what git would report for the branches. 
 - 
get_attribute(path, name, flags)¶
- Parameters: - path (str) – the relative path to the file.
- name (str) – the name of the attribute.
- flags (Ggit.AttributeCheckFlags) – aGgit.AttributeCheckFlags.
 - Raises: - Returns: - the attribute value, or - None.- Return type: - Get the attribute value of the specified attribute for the given file. 
- path (
 - 
get_config()¶
- Raises: - GLib.Error- Returns: - a - Ggit.Config.- Return type: - Ggit.Configor- None- Get the config for a specific repository. 
 - 
get_default_notes_ref()¶
- Raises: - GLib.Error- Returns: - the default notes reference for self. - Return type: - stror- None- Gets the default notes reference for self. It defaults to “refs/notes/commits”. 
 - 
get_descendant_of(commit, ancestor)¶
- Parameters: - Raises: - Returns: - Trueif commit is a descendant of ancestor, or- Falseotherwise.- Return type: - Check whether com mit is a descendant of ancestor. Note that if this function returns - False, an error might have occurred. If so, error will be set appropriately.
 - 
get_head()¶
- Raises: - GLib.Error- Returns: - a - Ggit.Ref- Return type: - Ggit.Refor- None- Get and resolves the current HEAD reference of the repository. Note that the returned ref is already resolved (if HEAD is symbolic). If you want to retrieve the symbolic ref called HEAD, then use - Ggit.Repository.lookup_referenceinstead.
 - 
get_index()¶
- Raises: - GLib.Error- Returns: - a - Ggit.Index.- Return type: - Ggit.Indexor- None- Get the index for a specific repository. 
 - 
get_location()¶
- Returns: - the location of the gitdir of the repository. - Return type: - Gio.Fileor- None- Get the gitdir location of the repository. 
 - 
get_submodule_status(name, ignore)¶
- Parameters: - name (str) – the name of the submodule.
- ignore (Ggit.SubmoduleIgnore) – the ignore rules to follow.
 - Raises: - Returns: - the - Ggit.SubmoduleStatusfor submodule.- Return type: - Gets the status for a submodule. This looks at a submodule and tries to determine the status. It will return a combination of the %GGIT_SUBMODULE_STATUS values. How deeply it examines the working directory to do this will depend on ignore. 
- name (
 - 
get_workdir()¶
- Returns: - the location of the working directory of the repository. - Return type: - Gio.Fileor- None- Gets the working directory of the repository. 
 - 
is_empty()¶
- Raises: - GLib.Error- Returns: - Trueif the repository is empty.- Return type: - bool- Checks if self is empty. - An empty repository has just been initialized and contains no commits. 
 - 
is_head_detached()¶
- Raises: - GLib.Error- Returns: - Trueif HEAD is detached.- Return type: - bool- Checks if self’s HEAD is detached. - A repository’s HEAD is detached when it points directly to a commit instead of a branch. 
 - 
is_head_unborn()¶
- Raises: - GLib.Error- Returns: - Trueif the current branch is an orphan.- Return type: - bool- Checks if self’s HEAD is an orphan. - An orphan branch is one named from HEAD but doesn’t exist in the refs namespace, because it doesn’t have any commit to point to. 
 - 
list_remotes()¶
- Raises: - GLib.Error- Returns: - a list with the remotes. - Return type: - [ - str] or- None- Fill a list with all the remotes in self. 
 - Raises: - GLib.Error- Returns: - a list with the tags in self. - Return type: - [ - str] or- None- Fill a list with all the tags in the self. 
 - Parameters: - pattern ( - stror- None) – a pattern to match.- Raises: - GLib.Error- Returns: - a list with matching tags in self. - Return type: - [ - str] or- None- Fill a list with all the tags in the self matching the provided pattern. The pattern can use standard fnmatch syntax. 
 - 
lookup(oid, gtype)¶
- Parameters: - oid (Ggit.OId) – aGgit.OId.
- gtype (GObject.GType) – aGObject.GType.
 - Raises: - Returns: - the found - Ggit.Object, or- Noneon error.- Return type: - Ggit.Objector- None- Lookups a reference to one of the objects in the self. - The generated reference must be freed with - GObject.Object.unref().- The gtype must match the type of the object in the odb; the method will fail otherwise. The special value - GObject.TYPE_NONEmay be passed to let the method guess the object’s type.
- oid (
 - 
lookup_blob(oid)¶
- Parameters: - oid ( - Ggit.OId) – a- Ggit.OId.- Raises: - GLib.Error- Returns: - a #GgitBlog pointer. - Return type: - Ggit.Blobor- None- Lookups a branch by its name in a repository. 
 - 
lookup_branch(branch_name, branch_type)¶
- Parameters: - branch_name (str) – the name of the branch.
- branch_type (Ggit.BranchType) – aGgit.BranchType.
 - Raises: - Returns: - a branch by its name in a repository. - Return type: - Ggit.Branchor- None- Lookups a branch by its name in a repository. 
- branch_name (
 - 
lookup_commit(oid)¶
- Parameters: - oid ( - Ggit.OId) – a- Ggit.OId.- Raises: - GLib.Error- Returns: - a - Ggit.Commitpointer.- Return type: - Ggit.Commitor- None- Lookups a branch by its name in a repository. 
 - 
lookup_reference(name)¶
- Parameters: - name ( - str) – the long name for the reference (e.g. HEAD, ref/heads/master, refs/tags/v0.1.0, …).- Raises: - GLib.Error- Returns: - the searched reference. - Return type: - Ggit.Refor- None- Lookups a reference by its name in self. The returned - Ggit.Refmust be freed with- GObject.Object.unref().
 - 
lookup_reference_dwim(short_name)¶
- Parameters: - short_name ( - str) – the short name for the reference (e.g. master, v0.1.0, …).- Raises: - GLib.Error- Returns: - the searched reference. - Return type: - Ggit.Refor- None- Lookups a reference by its short name in self applying the git precendence rules to the given shorthand to determine which reference the user is referring to. The returned - Ggit.Refmust be freed with- GObject.Object.unref().
 - 
lookup_remote(name)¶
- Parameters: - name ( - str) – the remote’s name.- Raises: - GLib.Error- Returns: - a new - Ggit.Remoteor- Noneif there is an error.- Return type: - Ggit.Remoteor- None- Gets the remote called name. 
 - 
lookup_submodule(name)¶
- Parameters: - name ( - str) – the name of the submodule.- Raises: - GLib.Error- Returns: - a newly-allocated - Ggit.Submodule.- Return type: - Ggit.Submoduleor- None- Lookups a submodule information by name or path. If the submodule does not exist, - Noneis returned and a- Ggit.Error.NOTFOUNDerror set.
 - 
lookup_tag(oid)¶
- Parameters: - oid ( - Ggit.OId) – a- Ggit.OId.- Raises: - GLib.Error- Returns: - a - Ggit.Tagpointer.- Return type: - Ggit.Tagor- None- Lookups a branch by its name in a repository. 
 - 
lookup_tree(oid)¶
- Parameters: - oid ( - Ggit.OId) – a- Ggit.OId.- Raises: - GLib.Error- Returns: - a - Ggit.Treepointer.- Return type: - Ggit.Treeor- None- Lookups a branch by its name in a repository. 
 - 
merge(their_heads, merge_opts, checkout_opts)¶
- Parameters: - their_heads ([Ggit.AnnotatedCommit]) – the heads to merge into
- merge_opts (Ggit.MergeOptions) – merge options
- checkout_opts (Ggit.CheckoutOptions) – checkout options
 - Raises: - Merges the given commit(s) into HEAD, writing the results into the working directory. Any changes are staged for commit and any conflicts are written to the index. - Callers should inspect the repository’s index after this completes, resolve any conflicts and prepare a commit. 
- their_heads ([
 - 
merge_base(oid_one, oid_two)¶
- Parameters: - Raises: - Returns: - Return type: - Find the merge base between two commits 
 - 
merge_commits(our_commit, their_commit, merge_options)¶
- Parameters: - our_commit (Ggit.Commit) – the commit that reflects the destination tree.
- their_commit (Ggit.Commit) – the commit that reflects the source tree.
- merge_options (Ggit.MergeOptions) – the merge options.
 - Raises: - Returns: - a new - Ggit.Indexor- Noneif an error occurred.- Return type: - Ggit.Indexor- None- Merge two commits creating a - Ggit.Indexreflecting the result of the merge.
- our_commit (
 - 
merge_trees(ancestor_tree, our_tree, their_tree, merge_options)¶
- Parameters: - ancestor_tree (Ggit.Tree) – the common ancestor between the trees, orNone.
- our_tree (Ggit.Tree) – the tree that reflects the destination tree.
- their_tree (Ggit.Tree) – the tree that reflects the source tree.
- merge_options (Ggit.MergeOptions) – the merge options.
 - Raises: - Returns: - a new - Ggit.Indexor- Noneif an error occurred.- Return type: - Ggit.Indexor- None- Merge two trees creating a - Ggit.Indexreflecting the result of the merge.
- ancestor_tree (
 - 
note_foreach(notes_ref, callback, *user_data)¶
- Parameters: - notes_ref (strorNone) – canonical name of the reference to use, orNoneto use the default ref.
- callback (Ggit.NoteCallback) – aGgit.NoteCallback.
- user_data (objectorNone) – callback user data.
 - Raises: - Returns: - Return type: - Loop over all the notes within a specified namespace and issue a callback for each one. If callback returns a non-zero value, this will stop looping. 
- notes_ref (
 - 
path_is_ignored(path)¶
- Parameters: - path ( - str) – A path within the repository.- Raises: - GLib.Error- Returns: - Trueif path should be ignored.- Return type: - bool- Tests if the ignore rules apply to the path provided. - This acts similar to filtering performed when calling “git add .” on the command line. 
 - 
read_note(notes_ref, id)¶
- Parameters: - Raises: - Returns: - the read note or - Nonein case of an error.- Return type: - Reads the note for an object. 
 - 
rebase_init(branch, upstream, onto, options)¶
- Parameters: - branch (Ggit.AnnotatedCommitorNone) – the terminal commit to rebase, orNoneto rebase the current branch.
- upstream (Ggit.AnnotatedCommitorNone) – the commit to begin rebasing from, orNoneto rebase all reachable commits.
- onto (Ggit.AnnotatedCommitorNone) – the branch to rebase onto, orNoneto rebase onto the given upstream.
- options (Ggit.RebaseOptions) – aGgit.RebaseOptionsto specify how rebase is performed, orNone.
 - Raises: - Returns: - a newly allocated - Ggit.Rebase.- Return type: - Ggit.Rebaseor- None- Initializes a rebase operation to rebase the changes in branch relative to upstream onto another branch. To begin the rebase process, call git_rebase_next(). When you have finished with this object, call - GObject.Object.unref().
- branch (
 - 
rebase_open(options)¶
- Parameters: - options ( - Ggit.RebaseOptions) – a- Ggit.RebaseOptionsto specify how rebase is performed, or- None.- Raises: - GLib.Error- Returns: - a newly allocated - Ggit.Rebase.- Return type: - Ggit.Rebaseor- None- Opens an existing rebase that was previously started by either an invocation of ggit_rebase_init() or by another client. 
 - 
references_foreach(callback, *user_data)¶
- Parameters: - callback (Ggit.ReferencesCallback) – aGgit.ReferencesCallback.
- user_data (objectorNone) – callback user data.
 - Raises: - Returns: - Return type: - Gathers references and run a callback for each one. - To the callback is passed the reference and the data pointer passed to this function. If the callback returns something other than 0, the iteration will stop and error will be set. 
- callback (
 - 
references_foreach_name(callback, *user_data)¶
- Parameters: - callback (Ggit.ReferencesNameCallback) – aGgit.ReferencesNameCallback.
- user_data (objectorNone) – callback user data.
 - Raises: - Returns: - Return type: - Gathers reference names and run a callback for each one. - To the callback is passed the name of the reference and the data pointer passed to this function. If the callback returns something other than 0, the iteration will stop and error will be set. 
- callback (
 - 
remove_note(notes_ref, author, committer, id)¶
- Parameters: - notes_ref (strorNone) – canonical name of the reference to use, orNoneto use the default ref.
- author (Ggit.Signature) – author signature.
- committer (Ggit.Signature) – committer signature.
- id (Ggit.OId) – OID of the git object to decorate.
 - Raises: - Returns: - Trueif the note was removed from id.- Return type: - Removes the note for an object. 
- notes_ref (
 - 
remove_remote(name)¶
- Parameters: - name ( - str) – the remote’s name.- Raises: - GLib.Error- Returns: - Trueif there was no error,- Falseotherwise- Return type: - bool- Removes remote from the self. 
 - 
rename_remote(name, new_name)¶
- Parameters: - Raises: - Returns: - non-default refspecs that cannot be renamed. - Return type: - Rename the remote of self from name to new_name. 
 - 
reset(target, reset_type, checkout_options)¶
- Parameters: - target (Ggit.Object) – the targetGgit.Objectwhich is a commit or a tag.
- reset_type (Ggit.ResetType) – theGgit.ResetTypeto perform.
- checkout_options (Ggit.CheckoutOptions) – theGgit.CheckoutOptionsto be used for a HARD reset.
 - Raises: - Performs a reset of type reset_type on self to target, or error will be set. 
- target (
 - 
reset_default(target, pathspecs)¶
- Parameters: - target (Ggit.ObjectorNone) – the targetGgit.Objectwhich is a commit or a tag.
- pathspecs ([str]) – a list of file paths to reset.
 - Raises: - Update some entries in the index from the target commit tree. The scope of the updated entries is determined by the paths specified in pathspecs. Passing - Nonein target will result in removing entries in the index matching the provided pathspecs.
- target (
 - 
revert(commit, options)¶
- Parameters: - commit (Ggit.Commit) – aGgit.Commit.
- options (Ggit.RevertOptions) – aGgit.RevertOptions.
 - Raises: - Returns: - Return type: - Revert the given commit on top of the current working directory. 
- commit (
 - 
revparse(spec)¶
- Parameters: - spec ( - str) – the revision specification.- Raises: - GLib.Error- Returns: - a - Ggit.Objector- Noneif the revision could not be found.- Return type: - Ggit.Objector- None- Find an object, as specified by a revision string. See - man gitrevisions, or the documentation for- git rev-parsefor information on the syntax accepted.
 - 
save_stash(stasher, message, flags)¶
- Parameters: - stasher (Ggit.Signature) – aGgit.Signature.
- message (str) – description along with the stashed state orNoneto be autogenerated.
- flags (Ggit.StashFlags) – aGgit.StashFlagsto control the stashing process.
 - Raises: - Returns: - a new object id of the commit containing the stashed state. - Return type: - Saves the local modifications to a new stash. It returns the commit containing the stashed state. This commit is also the target of the direct reference refs/stash. 
- stasher (
 - 
set_head(ref_name)¶
- Parameters: - ref_name ( - str) – canonical name of the reference HEAD should point to.- Raises: - GLib.Error- Returns: - Trueif head was successfully set,- Falseotherwise.- Return type: - bool
 - 
set_remote_url(remote, url)¶
- Parameters: - Raises: - Returns: - Return type: - Sets url for the remote from the self. 
 - 
set_submodule_fetch_recurse(name, fetch_recurse_submodules)¶
- Parameters: - name (str) – the name of the submodule.
- fetch_recurse_submodules (Ggit.SubmoduleRecurse) – aGgit.SubmoduleRecurse.
 - Raises: - Sets the submodule.’name’.fetchRecurseSubmodules value for the submodule. This setting won’t affect any existing instances.. 
- name (
 - 
set_submodule_ignore(name, ignore)¶
- Parameters: - name (str) – the name of the submodule.
- ignore (Ggit.SubmoduleIgnore) – aGgit.SubmoduleIgnore.
 - Raises: - Sets the ignore rule for the submodule in the configuration. This does not affect any currently-loaded instances.. 
- name (
 - 
set_submodule_update(name, update)¶
- Parameters: - name (str) – the name of the submodule.
- update (Ggit.SubmoduleUpdate) – aGgit.SubmoduleUpdate.
 - Raises: - Sets the update rule for the submodule in the configuration. This setting won’t affect any existing instances. 
- name (
 - 
set_submodule_url(name, url)¶
- Parameters: - Raises: - Sets the URL for the submodule in the configuration. - After calling this, you may wish to call - Ggit.Submodule.sync() to write the changes to the checked out submodule repository.
 - 
set_workdir(workdir, update_gitlink)¶
- Parameters: - Sets the working directory of the repository. If update_gitlink is set to - True“core.worktree” will be set in the config if workdir is not the parent of the .git directory).
 - 
stash_foreach(callback, *user_data)¶
- Parameters: - callback (Ggit.StashCallback) – aGgit.StashCallback.
- user_data (objectorNone) – callback user data.
 - Raises: - Returns: - Return type: - Loops over all the stashed states and issue a callback for each one. If callback returns a non-zero value, this will stop looping. 
- callback (
 - 
submodule_foreach(callback, *user_data)¶
- Parameters: - callback (Ggit.SubmoduleCallback) – aGgit.StatusCallback.
- user_data (objectorNone) – callback user data.
 - Raises: - Returns: - Return type: - Gathers submodules and run a callback for each one. - To the callback is passed the submodule instance and name. If the callback returns something other than 0, the iteration will stop and error will be set. - NOTE: the submodule instance passed to the callback is only valid during the call to - Ggit.Repository.submodule_foreachand may not be used after the call has finished.
- callback (
 - 
tag_foreach(callback, *user_data)¶
- Parameters: - callback (Ggit.TagCallback) – aGgit.TagCallback.
- user_data (objectorNone) – callback user data.
 - Raises: - Returns: - Return type: - Get all the tags in the repository and run the provided callback on each. If the callback returns something other than 0, the iteration will stop and error will be set. 
- callback (
 
- 
classmethod 
Property Details¶
- 
Ggit.Repository.props.clone_options¶
- Name: - clone-options- Type: - Ggit.CloneOptions- Default Value: - None- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- Clone options 
- 
Ggit.Repository.props.init¶
- Name: - init- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- Whether to initialize a repository 
- 
Ggit.Repository.props.is_bare¶
- Name: - is-bare- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- Is a bare repository 
- 
Ggit.Repository.props.location¶
- Name: - location- Type: - Gio.File- Default Value: - None- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- The location of the repository