I have a repository on Github which consist of two branches. I am trying to use Git-Plus:Clone
in Atom
to try to clone all repositories. However, all my attempts have failed and only the master
branch gets cloned. I have looked this problem up on SE but could not find a way to do it. Can someone kindly help me figure this out. Thanks in advance !
Use the git clone Command to Clone All Branches in Git Clone your repository with the git clone command. Then navigate to the directory where your project is located. Use the git branch command to view local branches. This command will only show you local branches.
Clone repositories To clone a repository, open the GitHub panel while you have no project folders open in Atom and click "Clone an existing GitHub repository". In the dialog, paste the URL of a repository and click "Clone". The new project will be added to the Tree View.
Atom can be used as your Git commit editor and ships with the language-git package which adds syntax highlighting to edited commit, merge, and rebase messages. You can configure Atom to be your Git commit editor with the following command: git config --global core.editor "atom --wait"
However, all my attempts have failed and only the master branch gets cloned.
This behavior is not unique to Atom. It's the normal git clone
behavior.
All branches are cloned, but git clone
will only automatically make a local branch for master
or whatever the default branch for the repository is. The rest remain as "remote tracking branches", local copies of the remote. They're on your disk, but they're effectively read-only. Git does this to avoid flooding your clone with possibly a bazillion irrelevant local branches, should the project you're cloning have a lot of branches.
For example, if your remote has master
, foo
, and bar
. You will wind up with origin/master
, origin/foo
, origin/bar
, and master
. origin/...
are all remote tracking branches. They remember the state of the remote repository the last time you looked at it (with a git clone
, or fetch
or pull
).
master
is a local branch of origin/master
for you to work on. If you want to work on another branch, make a local version of it. For example, git checkout -b origin/foo foo
would create a local foo
for you to work on (or however you do it in Atom).
See also this answer.
In Atom, install Git Plus package in Preferences, then toggle command palette (on mac it's cmd+shift+p) and type checkout, select "Git Plus: Checkout Remote" from the suggested list of items in the drop-down menu.
Then you just need to select the target repo and branch you wish to check out and the remote branch will become local and you will be able to work on it and switch between different branches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With