Skip to content

How to implement the equivalent of "git checkout" #50

Closed
davidfowl opened this Issue Jun 26, 2011 · 6 comments

4 participants

@davidfowl

Is there any way to update the working directory to a specific commit id or branch name? Basically the equivalent of "git checkout {branch name}" or "git checkout {somesha1}",

@nulltoken
libgit2 member

Unfortunately, it's not implemented yet in libgit2.

@alex-shpilkin

It was mentioned on the mailing list that the problem with this is implementing gitattributes. Now that attributes are (somewhat) here, what else is needed for doing a checkout?

@nulltoken
libgit2 member

@alex-shpilkin I think this question would get a better exposure (and therefore be better answered) in either the libgit2 issue tracker or the libigit2 mailing list. May I suggest you to ask it over there ?

@kaisellgren

Isn't this already implemented: https://github.com/libgit2/libgit2sharp/blob/vNext/LibGit2Sharp/Repository.cs#L373 ? (In the current vNext that is)

I guess this gets closed after it's released?

@nulltoken
libgit2 member

@kaisellgren Not completely. The HEAD moves to the selected target, but the working directory is not updated with the content of the commit tree yet.

@nulltoken
libgit2 member

Closing this as Repository.Checkout() now also takes care of updating the working directory (cf. CheckoutFixture.cs)

@nulltoken nulltoken closed this Jan 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.