Chapsterj
Chapsterj

Reputation: 6625

finding a git branch path

I'm trying to send someone a clone link for a git repository.

so this will give me access to cloning the master. But I want to give out a branch clone path how would I go about finding that path using terminal. The branch is a remote branch.

[email protected]:mainproject.git

Upvotes: 0

Views: 18935

Answers (2)

Fatih Arslan
Fatih Arslan

Reputation: 17117

Just look for remote branches

git branch -r

After that give clone it via

git clone [email protected]:mainproject.git -b remote_branchh

Upvotes: 0

larsks
larsks

Reputation: 311288

I'm not sure what you mean by "branch clone path", but maybe this will help...

When you a clone a remote repository, you get all the branches. You typically end up on the master branch, after which you can select your branch using the checkout command:

$ git clone [email protected]:mainproject.git
$ cd mainproject
$ git checkout mybranch

If you want to end up on a branch other than master as part of the clone operation, you can use the -b (--branch) option:

$ git clone -b mybranch [email protected]:mainproject.git

This would switch the local repository to the mybranch branch after completing the clone operation. This is identical to the above sequence of commands (well, other than the cd command).

If this doesn't address your question, please let me know.

Upvotes: 4

Related Questions