git-clone

How do I clone a specific Git branch? [duplicate]

一曲冷凌霜 提交于 2019-11-26 03:27:30
问题 This question already has an answer here: How do I clone a single branch in Git? 15 answers Git clone will behave copying remote current working branch into local. Is there any way to clone a specific branch by myself without switching branches on the remote repository? 回答1: git clone --single-branch --branch <branchname> <remote-repo> The --single-branch option is valid from version 1.7.10 and later. Please see also the other answer which many people prefer. You may also want to make sure

Why can&#39;t I push from a shallow clone?

浪子不回头ぞ 提交于 2019-11-26 03:18:56
问题 The git clone --depth command option says --depth <depth> Create a shallow clone with a history truncated to the specified number of revisions. A shallow repository has a number of limitations (you cannot clone or fetch from it, nor push from nor into it), but is adequate if you are only interested in the recent history of a large project with a long history, and would want to send in fixes as patches. Why do shallow clones have this limitation? Why is it a patches only workflow? For some

How to git-svn clone the last n revisions from a Subversion repository?

こ雲淡風輕ζ 提交于 2019-11-26 02:26:27
问题 Problem How do you create a shallow copy with git-svn from a Subversion repository, e.g. how do you pull only the last three revisions? The git clone command can get the last n revisions from a Git repository if you use the option --depth , i.e. you get a shallow copy of the repository. Example: git clone --depth 3 git://some/repo myshallowcopyrepo Is there a similar option for git-svn? My discoveries so far So far I\'ve only found the -rN option where N is the revision to pull. Example: git

Download a specific tag with Git

蓝咒 提交于 2019-11-26 01:34:19
问题 I\'m trying to figure out how I can download a particular tag of a Git repository - it\'s one version behind the current version. I saw there was a tag for the previous version on the git web page, with object name of something long hex number. But the version name is \" Tagged release 1.1.5 \" according the site. I tried a command like this (with names changed): git clone http://git.abc.net/git/abc.git my_abc And I did get something - a directory, a bunch of subdirectories, etc. If it\'s the

Git push requires username and password

牧云@^-^@ 提交于 2019-11-26 01:21:23
问题 I cloned a Git repository from my GitHub account to my PC. I want to work with both my PC and laptop, but with one GitHub account. When I try to push to or pull from GitHub using my PC, it requires username and password, but not when using the laptop! I don\'t want to type my username and password every time I interact with origin. What am I missing here? 回答1: A common mistake is cloning using the default (HTTPS) instead of SSH. You can correct this by going to your repository, clicking

How do you clone a Git repository into a specific folder?

别等时光非礼了梦想. 提交于 2019-11-26 01:02:23
问题 Executing the command git clone git@github.com:whatever creates a directory in my current folder named whatever, and drops the contents of the Git repository into that folder: /httpdocs/whatever/public My problem is that I need the contents of the Git repository cloned into my current directory so that they appear in the proper location for the web server: /httpdocs/public I know how to move the files after I\'ve cloned the repository, but this seems to break Git, and I\'d like to be able to

What&#39;s the difference between git clone --mirror and git clone --bare

情到浓时终转凉″ 提交于 2019-11-26 00:35:17
问题 The git clone help page has this to say about --mirror : Set up a mirror of the remote repository. This implies --bare . But doesn\'t go into detail about how the --mirror clone is different from a --bare clone. 回答1: The difference is that when using --mirror , all refs are copied as-is . This means everything: remote-tracking branches, notes, refs/originals/* (backups from filter-branch). The cloned repo has it all. It's also set up so that a remote update will re-fetch everything from the

Is it safe to shallow clone with --depth 1, create commits, and pull updates again?

北城以北 提交于 2019-11-25 23:48:30
问题 The --depth 1 option in git clone: Create a shallow clone with a history truncated to the specified number of revisions. A shallow repository has a number of limitations (you cannot clone or fetch from it, nor push from nor into it), but is adequate if you are only interested in the recent history of a large project with a long history, and would want to send in fixes as patches. But I\'ve successfully done a shallow clone, committed some changes and pushed those changes back to the (bare

What are the differences between git branch, fork, fetch, merge, rebase and clone?

て烟熏妆下的殇ゞ 提交于 2019-11-25 23:47:43
问题 I want to understand the difference between a branch, a fork and a clone in Git? Similarly, what does it mean when I do a git fetch as opposed to a git pull ? Also, what does rebase mean in comparison to merge ? How can I squash individual commits themselves together? How are they used, why are they used and what do they represent? How does GitHub figure in? 回答1: A clone is simply a copy of a repository. On the surface, its result is equivalent to svn checkout , where you download source code

How to convert a normal Git repository to a bare one?

拟墨画扇 提交于 2019-11-25 23:19:40
问题 How can I convert a \'normal\' Git repository to a bare one? The main difference seems to be: in the normal git repository you have a .git folder inside the repository containing all relevant data and all other files build your working copy in a bare Git repository, there is no working copy and the folder (let\'s call it repo.git ) contains the actual repository data 回答1: In short: replace the contents of repo with the contents of repo/.git , then tell the repository that it is now a bare