File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,13 @@ GIT_EXTERN(int) git_checkout_init_options(
313313 * Updates files in the index and the working tree to match the content of
314314 * the commit pointed at by HEAD.
315315 *
316+ * Note that this is _not_ the correct mechanism used to switch branches;
317+ * do not change your `HEAD` and then call this method, that would leave
318+ * you with checkout conflicts since your working directory would then
319+ * appear to be dirty. Instead, checkout the target of the branch and
320+ * then update `HEAD` using `git_repository_set_head` to point to the
321+ * branch you checked out.
322+ *
316323 * @param repo repository to check out (must be non-bare)
317324 * @param opts specifies checkout options (may be NULL)
318325 * @return 0 on success, GIT_EUNBORNBRANCH if HEAD points to a non
You can’t perform that action at this time.
0 commit comments