Created
March 18, 2016 15:33
-
-
Save tienhv/232a034f7fb9bff3b4cd to your computer and use it in GitHub Desktop.
put the git folder out of source folder
This file contains hidden or 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
| #http://stackoverflow.com/questions/17913550/git-moving-the-git-directory-to-another-drive-keep-the-source-code-where-it | |
| gitdir: | |
| Or you can replace the .git folder with a file that tells git where the .git folder really is. This is exactly how git submodules are setup by default in version 1.7.8 or later. | |
| The steps to re-configure an existing checkout are: | |
| move the .git dir to where it needs to be | |
| replace it with a file .git containing: gitdir: path/to/.git | |
| define core.worktree to point at the working copy | |
| As a script that would be: | |
| $ cd my/project | |
| $ mv .git /tmp/.git | |
| $ echo "gitdir: /tmp/.git" > .git | |
| $ git config core.worktree $PWD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment