Last active
January 15, 2021 13:59
-
-
Save bowmanjd/3d56cf4e2fc11cba2137cb7ce36c4de6 to your computer and use it in GitHub Desktop.
Adds two functions for instantiating dotfile management with git
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
# OUT="$(mktemp)"; wget -q -O - https://gist.github.com/bowmanjd/3d56cf4e2fc11cba2137cb7ce36c4de6/raw > $OUT; . $OUT | |
dtfnew () { | |
git init -b base | |
git remote add origin $1 | |
# Uncomment one of the following 3 lines | |
git config --local status.showUntrackedFiles no | |
# echo '/**' >> .git/info/exclude | |
# echo '/**' >> .gitignore; git add -f .gitignore | |
echo "Please add and commit additional files, then run" | |
echo "git push -u origin base" | |
} | |
dtfrestore () { | |
git init -b base | |
git remote add origin $1 | |
# Uncomment one of the following 2 lines unless repo has '/**' line in a .gitignore | |
git config --local status.showUntrackedFiles no | |
# echo '/**' >> .git/info/exclude | |
git fetch --set-upstream origin base | |
git switch --no-overwrite-ignore base || echo -e 'Deal with conflicting files, then run (possibly with -f flag if you are OK with overwriting)\ngit switch base' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment