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

Git This answer includes GitHub as many folks have asked about that too. Local repositories Git (locally) has a directory (.git) which you commit your files to and this is your ‘local repository’. This is different from systems like SVN where you add and commit to the remote repository immediately. Git stores each version of … Read more

What’s the difference between git clone –mirror and git clone –bare

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 origin (overwriting the copied refs). The idea is really to mirror the repository, … Read more

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

Note that Git 1.9/2.0 (Q1 2014) has removed that limitation. See commit 82fba2b, from Nguyễn Thái Ngọc Duy (pclouds): Now that git supports data transfer from or to a shallow clone, these limitations are not true anymore. The documentation now reads: –depth <depth>:: Create a ‘shallow’ clone with a history truncated to the specified number … Read more

Are Git forks actually Git clones?

Fork, in the GitHub context, doesn’t extend Git. It only allows clone on the server side. When you clone a GitHub repository on your local workstation, you cannot contribute back to the upstream repository unless you are explicitly declared as “contributor”. That’s because your clone is a separate instance of that project. If you want … Read more

How do I clone a single branch in Git?

Note: the git1.7.10 (April 2012) actually allows you to clone only one branch: # clone only the remote primary HEAD (default: origin/master) git clone <url> –single-branch # as in: git clone <url> –branch <branch> –single-branch [<folder>] (<url> is the URL if the remote repository, and does not reference itself the branch cloned) You can see … Read more

Download a specific tag with Git

$ git clone will give you the whole repository. After the clone, you can list the tags with $ git tag -l and then checkout a specific tag: $ git checkout tags/<tag_name> Even better, checkout and create a branch (otherwise you will be on a branch named after the revision number of tag): $ git … Read more

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

Option A: git clone [email protected]:whatever folder-name Ergo, for right here use: git clone [email protected]:whatever . Option B: Move the .git folder, too. Note that the .git folder is hidden in most graphical file explorers, so be sure to show hidden files. mv /where/it/is/right/now/* /where/I/want/it/ mv /where/it/is/right/now/.* /where/I/want/it/ The first line grabs all normal files, the … Read more