summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlosmn@github.com>2016-06-16 08:53:30 +0200
committerGitHub <noreply@github.com>2016-06-16 08:53:30 +0200
commit3e9830d7bc29f214ec2420eed2bf7de4c02720da (patch)
tree9c47e3484344f58eda5a4613bad77f90cd3166aa
parentabb6f72aaacd4edb4131d1bdb8d0965bd189ee82 (diff)
parentb92664883999f4d41fcf471cdf627946fafa364d (diff)
downloadlibgit2-3e9830d7bc29f214ec2420eed2bf7de4c02720da.tar.gz
Merge pull request #3822 from libgit2/ethomson/checkout_head_docs
documentation: improve docs for `checkout_head`
-rw-r--r--include/git2/checkout.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/git2/checkout.h b/include/git2/checkout.h
index 6cf9ed8bd..4a9dbb021 100644
--- a/include/git2/checkout.h
+++ b/include/git2/checkout.h
@@ -313,6 +313,13 @@ GIT_EXTERN(int) git_checkout_init_options(
* 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.
+ *
* @param repo repository to check out (must be non-bare)
* @param opts specifies checkout options (may be NULL)
* @return 0 on success, GIT_EUNBORNBRANCH if HEAD points to a non