Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » how to create git branch in remote repository without checking out using jgit
how to create git branch in remote repository without checking out using jgit [message #1403479] Thu, 24 July 2014 05:23 Go to next message
Samith Dassanayake is currently offline Samith DassanayakeFriend
Messages: 2
Registered: July 2014
Junior Member
Can we create a remote branch in git using jgit without checking out the branch that we are going to branch from. For example I want to create a branch named foo from branch named bar in my remote repository without checking out branch bar locally.
Re: how to create git branch in remote repository without checking out using jgit [message #1403616 is a reply to message #1403479] Thu, 24 July 2014 15:20 Go to previous messageGo to next message
Stefan Lay is currently offline Stefan LayFriend
Messages: 342
Registered: July 2009
Senior Member
This should be possible using e.g. the PushCommand with a refspec refs/remotes/origin/bar:refs/heads/foo.
Re: how to create git branch in remote repository without checking out using jgit [message #1403625 is a reply to message #1403616] Thu, 24 July 2014 16:22 Go to previous messageGo to next message
Samith Dassanayake is currently offline Samith DassanayakeFriend
Messages: 2
Registered: July 2014
Junior Member
Hi Stefan
But for do that as you mentioned, I have to clone the branch bar into my local repo right?. My requirement is to create a new branch foo from the branch bar without cloning branch bar into my local repo(machine)
Re: how to create git branch in remote repository without checking out using jgit [message #1403678 is a reply to message #1403625] Fri, 25 July 2014 09:06 Go to previous messageGo to next message
Stefan Lay is currently offline Stefan LayFriend
Messages: 342
Registered: July 2009
Senior Member
Yes, you have to have a local clone in order to be able to run jgit against a remote repository. AFAIK there is no client which can change a remote repository without a local clone.
Re: how to create git branch in remote repository without checking out using jgit [message #1403879 is a reply to message #1403678] Mon, 28 July 2014 12:02 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1072
Registered: July 2009
Senior Member
On some git servers you can create branches directly on the server though this isn't supported by jgit
since this isn't part of the standard git protocols.

In Github this can be done as described here [1].
In Gerrit this can be done as described here [2].

[1] https://help.github.com/articles/creating-and-deleting-branches-within-your-repository
[2] https://gerrit-review.googlesource.com/Documentation/project-configuration.html#branch-creation
Previous Topic:Commit single file or single project only
Next Topic:Issue with Configure Git repository
Goto Forum:
  


Current Time: Sat Aug 24 15:25:45 GMT 2019

Powered by FUDForum. Page generated in 0.02084 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top