Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloning a remote repository with Git GUI ( How to download branches? )

I'm testing Git GUI software (windows version). I cloned a remote repository and now, I only have master branch selectable on my local repo using Git GUI.

In the remote repo there is a "dev" branch too, but it is not selectable locally. Is this a bug or is the normal behaviour? I'm searching for the best way to get access to "dev" branch locally.

Thank you

like image 761
NullPointerException Avatar asked Jan 18 '17 07:01

NullPointerException


People also ask

How do I get branches from remote repository?

If you have a single remote repository, then you can omit all arguments. just need to run git fetch , which will retrieve all branches and updates, and after that, run git checkout <branch> which will create a local copy of the branch because all branches are already loaded in your system.

How do I download a git repository branch?

While on a branch, clicking “Download Zip” from the Code dropdown will lead you to a download for the specific branch you're on. It doesn't tell you this on the site though, so you'll have to make sure that the filename for the download URL matches the correct branch, named in reponame-branchname. zip format.

How do I clone an entire git repository including branches?

The idea is to use the git-clone to clone the repository. This will automatically fetch all the branches and tags in the cloned repository. To check out the specific branch, you can use the git-checkout command to create a local tracking branch.

How do I clone a specific branch in git GUI?

Steps as below: Git GUI -> branch Tab -> checkout -> Tracking branch -> select origin/dev -> checkout -> branch Tab -> create -> name for dev and select this detached checkout -> create. Now you have a local dev branch the same as remote. You can check the history by repository Tab -> visualize dev's history.


1 Answers

You should checkout to origin/dev and then create a local branch dev. Steps as below:

Git GUI -> branch Tab -> checkout -> Tracking branch -> select origin/dev -> checkout -> branch Tab -> create -> name for dev and select this detached checkout -> create.

Now you have a local dev branch the same as remote. You can check the history by repository Tab -> visualize dev's history.

You can also commit changes for dev branch and push to remote dev branch.

like image 54
Marina Liu Avatar answered Sep 20 '22 00:09

Marina Liu