Skip to content

checkout_head is missing disclaimer #1148

@lolbinarycat

Description

@lolbinarycat

git_checkout_head has the following disclaimer:

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.

This should be translated to make sense with the rust api and included.

In my usecase git_checkout_head was doing literally nothing and it was very confusing.

Activity

added a commit that references this issue on Mar 25, 2025
fece563
vcfxb

vcfxb commented on Mar 25, 2025

@vcfxb
Contributor

@lolbinarycat feel free to review & make comments on #1149

added a commit that references this issue on Jun 21, 2025
added a commit that references this issue on Jun 21, 2025
70c48c3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @vcfxb@lolbinarycat

      Issue actions

        checkout_head is missing disclaimer · Issue #1148 · rust-lang/git2-rs