Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] How To Checkout with a Specified Tag using CheckoutCommand

Hi Chris,

Thanks for your reply. 

Actually I tried git.checkout().setName("my_tag").call(), it did checkout the tag, but it also throws a java.lang.NullPointerException. 
When I do a "git checkout my_tag" in git bash, it will checkout the version, and also it will tell me that "You are in 'detached HEAD' state..." Is this the reason why it throws a NullPointerException ?

Thanks again. 

Feichi


On Fri, Aug 15, 2014 at 12:56 PM, Chris Aniszczyk <caniszczyk@xxxxxxxxx> wrote:
When in doubt, it always helps to look at the corresponding tests... org.eclipse.jgit.api.CheckoutCommandTest

Should be as simple as git.checkout().setName("your version tag").call()...

Let us know if you need anymore help.


On Fri, Aug 15, 2014 at 1:10 PM, Feichi Feng <fengfeichi@xxxxxxxxx> wrote:
Hi,

I am using JGit in my project. Currently I have a repository with version tags. Now I want to checkout a version. For example, I wanna do

"git checkout <versino_tag_here>" in a git bash. 

I can successfully checkout with this command in a git bash. But is there anyway that I can do this using the JGit CheckoutCommand in Java code? Or any other ways to get this done using other classes of JGit library?

Thank you. 

--
Feichi Feng
Department of Electrical,Computer & Energy Engineering
University of Colorado at Boulder



_______________________________________________
jgit-dev mailing list
jgit-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jgit-dev



--
Cheers,

Chris Aniszczyk
http://aniszczyk.org
+1 512 961 6719



--
Feichi Feng
Department of Electrical,Computer & Energy Engineering
University of Colorado at Boulder



Back to the top