Skip to content

Instantly share code, notes, and snippets.

@bowmanjd
Last active January 15, 2021 13:59
Show Gist options
  • Save bowmanjd/3d56cf4e2fc11cba2137cb7ce36c4de6 to your computer and use it in GitHub Desktop.
Save bowmanjd/3d56cf4e2fc11cba2137cb7ce36c4de6 to your computer and use it in GitHub Desktop.
Adds two functions for instantiating dotfile management with git
# 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