On this page:
git_  checkout_  head
git_  checkout_  index
git_  checkout_  init_  options
git_  checkout_  tree
8.12

6 Checkout🔗ℹ

 (require libgit2/include/checkout) package: libgit2

procedure

(git_checkout_head repo opts)  integer?

  repo : repository?
  opts : (or/c git_checkout_opts? #f)
Updates files in the index and the working tree to match the content of the commit pointed at by HEAD.

Note that this is not the correct mechanism used to switch branches; do not change your HEAD and then call this method, that would leave you with checkout conflicts since your working directory would then appear to be dirty. Instead, checkout the target of the branch and then update HEAD using git_repository_set_head to point to the branch you checked out.

Passing #f for opts will use default checkout options.

procedure

(git_checkout_index repo index opts)  integer?

  repo : repository?
  index : index?
  opts : (or/c git_checkout_opts? #f)
Updates files in the working tree to match the content of the index.

Passing #f for opts will use default checkout options.

procedure

(git_checkout_init_options opts int)  integer?

  opts : git_checkout_opts?
  int : unsigned
Initializes a git_checkout_options with default values. Equivalent to creating an instance with GIT_CHECKOUT_OPTIONS_INIT.

procedure

(git_checkout_tree repo treeish opts)  integer?

  repo : repository?
  treeish : object?
  opts : (or/c git_checkout_options? #f)
Updates files in the index and working tree to match the content of the tree pointed at by the treeish.

Passing #f for opts will use default checkout options.