0

I am only trying to access a single branch, not all branches as in the the so-called duplicate questions.

Clone another users repository

git clone https://[email protected]/mvmn/jaudiotagger.git 

When I try to list branches it shows nothing

git branch 

It shows nothing, even though they do have branches.

e.g https://bitbucket.org/mvmn/jaudiotagger/src/generics_refactoring/

I'm trying to access the generics_refactoring branch

3

1 Answer 1

2

git branch only lists local branches.

To see remote branches, try git branch -r (or git branch -a for local + remote)

You might also need to git fetch beforehand to have fresh references.

Once you have checked out a branch locally, it will create a local version, which will indeed appear in the git branch output.

Sign up to request clarification or add additional context in comments.

6 Comments

Oka that works. does that mean gitclone only downloads the master branch ? I want on my local machine to switch to a particular remote branch so what would be the command needed to get and then switch to particular branch locally
You can just git checkout <branch> (without the origin/ prefix or it will just checkout the commit and detach HEAD) and it will create a local version, already set to push/pull to said remote branch. git clone does get all branches as remote references, but doesn't automatically create local counterparts for them.
Wont that just create a new local branch that happens to have same as remote branch, or will that actually get the remote branch ?
@PaulTaylor It will make the new branch point at the same commit the remote branch points to at the moment of creation, and link them for push/pull operations.
ok i did git checkout origin/generics_refactoring and that has worked, thanks
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.