git-clone

How do I clone a single branch in Git?

久未见 提交于 2019-11-25 22:58:25
问题 I have a local Git repository called \'skeleton\' that I use for storing project skeletons. It has a few branches, for different kinds of projects: casey@agave [~/Projects/skeleton] git branch * master rails c c++ If I want to check out the master branch for a new project, I can do casey@agave [~/Projects] git clone skeleton new Initialized empty Git repository in /Users/casey/Projects/new/.git/ and everything is how I want it. Specifically, the new master branch points to the skeleton master

How do I clone a subdirectory only of a Git repository?

时间秒杀一切 提交于 2019-11-25 22:54:42
问题 I have my Git repository which, at the root, has two sub directories: /finisht /static When this was in SVN, /finisht was checked out in one place, while /static was checked out elsewhere, like so: svn co svn+ssh://admin@domain.com/home/admin/repos/finisht/static static Is there a way to do this with Git? 回答1: EDIT : As of Git 2.19, this is finally possible, as can be seen in this answer: https://stackoverflow.com/a/52269934/2988. Consider upvoting that answer. Note: in Git 2.19, only client

Are Git forks actually Git clones?

心不动则不痛 提交于 2019-11-25 22:42:05
问题 I keep hearing people say they\'re forking code in Git. Git \"fork\" sounds suspiciously like Git \"clone\" plus some (meaningless) psychological willingness to forgo future merges. There is no fork command in Git, right? GitHub makes forks a little more real by stapling correspondence onto it. That is, you press the fork button and later, when you press the pull request button, the system is smart enough to email the owner. Hence, it\'s a little bit of a dance around repository ownership and

How to clone all remote branches in Git?

寵の児 提交于 2019-11-25 22:01:11
问题 I have a master and a development branch, both pushed to GitHub. I\'ve clone d, pull ed, and fetch ed, but I remain unable to get anything other than the master branch back. I\'m sure I\'m missing something obvious, but I have read the manual and I\'m getting no joy at all. 回答1: First, clone a remote Git repository and cd into it: $ git clone git://example.com/myproject $ cd myproject Next, look at the local branches in your repository: $ git branch * master But there are other branches