## GgitBranch GgitBranch |

## Synopsis

                        GgitBranch;
    struct              GgitBranchClass;
    enum                GgitBranchType;
    gint                (*GgitBranchesCallback)             (const gchar *branch_name,
                                                             GgitBranchType branch_type,
                                                             gpointer user_data);
    void                ggit_branch_delete                  (GgitBranch *branch,
                                                             GError **error);
    GgitBranch *        ggit_branch_move                    (GgitBranch *branch,
                                                             const gchar *new_branch_name,
                                                             GgitCreateFlags flags,
                                                             GError **error);
    const gchar *       ggit_branch_get_name                (GgitBranch *branch,
                                                             GError **error);
    GgitRef *           ggit_branch_get_upstream            (GgitBranch *branch,
                                                             GError **error);
    gboolean            ggit_branch_is_head                 (GgitBranch *branch,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----GgitObjectFactoryBase
             +----GgitNative
                   +----GgitRef
                         +----GgitBranch

      GEnum
       +----GgitBranchType

## Description

## Details

### GgitBranch

    typedef struct _GgitBranch GgitBranch;

Represents a branch object.

### struct GgitBranchClass

    struct GgitBranchClass {
    };

### enum GgitBranchType

    typedef enum {
    	GGIT_BRANCH_LOCAL  = 1,
    	GGIT_BRANCH_REMOTE = 2
    } GgitBranchType;

The type of a branch.

`GGIT_BRANCH_LOCAL` | specifies a local branch.
`GGIT_BRANCH_REMOTE` | specifies a remote branch.

### GgitBranchesCallback ()

    gint                (*GgitBranchesCallback)             (const gchar *branch_name,
                                                             GgitBranchType branch_type,
                                                             gpointer user_data);

The type of the callback functions for retrieving the branches in a GgitRepository. See `ggit_repository_branches_foreach()`.

`branch_name` : | the branch name.
`branch_type` : | a GgitBranchType.
`user_data` : | user-supplied data. [closure]
Returns : | 0 to go for the next branch or a GgitError in case there was an error.

### ggit_branch_delete ()

    void                ggit_branch_delete                  (GgitBranch *branch,
                                                             GError **error);

Deletes an existing branch reference.

If the branch is successfully deleted, this object is not useful anymore and if should be freed with `g_object_unref()`.

`branch` : | a GgitBranch.
`error` : | a GError for error reporting, or `NULL`.

### ggit_branch_move ()

    GgitBranch *        ggit_branch_move                    (GgitBranch *branch,
                                                             const gchar *new_branch_name,
                                                             GgitCreateFlags flags,
                                                             GError **error);

Moves/renames an existing branch reference.

`branch` : | a GgitBranch.
`new_branch_name` : | target name of the branch once the move is performed; this name is validated for consistency.
`flags` : | a GgitCreateFlags.
`error` : | a GError for error reporting, or `NULL`.
Returns : | the new branch. [transfer full]

### ggit_branch_get_name ()

    const gchar *       ggit_branch_get_name                (GgitBranch *branch,
                                                             GError **error);

Gets the name of the given local or remote branch.

`branch` : | a GgitBranch.
`error` : | a GError for error reporting, or `NULL`.
Returns : | the name of the given local or remote branch.

### ggit_branch_get_upstream ()

    GgitRef *           ggit_branch_get_upstream            (GgitBranch *branch,
                                                             GError **error);

Gets the reference supporting the remote tracking branch, given a local branch reference.

`branch` : | a GgitBranch.
`error` : | a GError for error reporting, or `NULL`.
Returns : | the reference supporting the remote tracking branch. [transfer full][allow-none]

### ggit_branch_is_head ()

    gboolean            ggit_branch_is_head                 (GgitBranch *branch,
                                                             GError **error);

Determines if the current local branch is pointed at by HEAD.

`branch` : | a GgitBranch.
`error` : | a GError for error reporting, or `NULL`.
Returns : | `TRUE` if the current local branch is pointed at by HEAD.