Created
November 17, 2011 13:32
-
-
Save timabell/1373136 to your computer and use it in GitHub Desktop.
script to provide multiple working folders for git in windows
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
@echo off | |
REM See: http://timwise.blogspot.com/2011/11/multiple-working-folders-for-git-on.html | |
if not "%2" == "" goto start | |
:usage | |
echo. | |
echo Usage: %0 SOURCE TARGET | |
echo. | |
echo Creates a new linked working copy from an existing working copy so you can work on multiple branches simultaneously whilst sharing history. | |
echo SOURCE is a full or relative path to the original working copy root | |
echo TARGET is the name of the folder you would like created for your new working copy. The new folder will be created in the current working directory. | |
goto end | |
:start | |
mkdir "%2" | |
mkdir "%2"\.git | |
junction "%2"\.git\hooks "%1"\.git\hooks > NUL | |
junction "%2"\.git\info "%1"\.git\info > NUL | |
junction "%2"\.git\logs "%1"\.git\logs > NUL | |
junction "%2"\.git\objects "%1"\.git\objects > NUL | |
junction "%2"\.git\refs "%1"\.git\refs > NUL | |
copy "%1"\.git\* "%2"\.git\ > NUL | |
echo Done. You can now go in to "%2", and check out a (new) branch. | |
:end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment