diff options
author | Edward Thomson <ethomson@github.com> | 2016-06-14 12:27:03 -0500 |
---|---|---|
committer | Carlos MartÃn Nieto <cmn@dwim.me> | 2016-10-01 17:40:38 +0200 |
commit | a574d84352fb9d21860f371b1dec23f55b90c873 (patch) | |
tree | bc1ab75842bf5ce1993101ea89d6f570abd07520 | |
parent | 27008e849f510622ac880bb818f0e928a9d1bdf6 (diff) | |
download | libgit2-a574d84352fb9d21860f371b1dec23f55b90c873.tar.gz |
documentation: improve docs for `checkout_head`
`git_checkout_head` is sadly misunderstood as something that can
switch branches. It cannot. Update the documentation to reflect this.
-rw-r--r-- | include/git2/checkout.h | 7 |
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 |