Last active
December 12, 2015 06:59
-
-
Save zaus/4733163 to your computer and use it in GitHub Desktop.
Common GIT commands for different scenarios?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# clone repository to current working directory (cwd) | |
git clone "{{repo}}" . | |
# clone a repository to the current directory, "symlinking" git files elsewhere, checking out single file | |
git clone -n --separate-git-dir="{{extpath}}\{{ProjectName}}" "{{path}}\{{ProjectName}}" . | |
git checkout HEAD {{file}} | |
## Explanation: | |
## 1. git | |
## clone | |
## -n no files checked out, just history; could use `--bare` as well? | |
## --separate-git-dir={{extpath}} where to put the `.git` directory, not cwd | |
## {{path}} the repository to clone | |
## . use current working directory -- won't work if not empty | |
## 2. git | |
## checkout | |
## HEAD latest | |
## {{file}} the filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment