Created
July 6, 2016 16:05
-
-
Save ethomson/8fdcfc61e039a20fa5c5d054c1eff44f to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
set -e | |
# clone a bare repository, because even with `--no-checkout`, clone will create a | |
# folder for a working directory, and it will ignore the `--git-dir` option. | |
# but the restore all the configuration that would be there. | |
git clone --bare [email protected]:/ethomson/dotfiles .dotfiles.git | |
git --git-dir=.dotfiles.git config core.bare false | |
git --git-dir=.dotfiles.git config push.default simple | |
git --git-dir=.dotfiles.git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/* | |
git --git-dir=.dotfiles.git config branch.master.remote origin | |
git --git-dir=.dotfiles.git config branch.master.merge refs/heads/master | |
# redo the fetch, just to get the remote tracking branches setup | |
git --git-dir=.dotfiles.git fetch | |
# don't show any untracked files | |
echo '*' > .dotfiles.git/info/exclude | |
# checkout the working directory | |
git --git-dir=.dotfiles.git checkout HEAD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment