Last active
April 18, 2018 00:30
-
-
Save danielsepulvedab/66f507afff9203fed8b7a4f52d94e086 to your computer and use it in GitHub Desktop.
Create repo to manage dotfiles
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
#!/bin/bash | |
# | |
# Inspired in this https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/ | |
# I'm creating this gist as a note to my future self | |
# Create bare repository | |
git init --bare $HOME/.myconfs | |
# Create alias to interact with the config directory | |
# It also should go in a .bash_profile and/or .bashrc files | |
alias config='git --git-dir=$HOME/.myconfs/ --work-tree=$HOME' | |
# Use the alias to configure local repository to not show untracked files | |
config config --local status.showUntrackedFiles no | |
# The next steps are only for the first time and if remote online origin is wanted | |
# config remote add origin <git-repo-url> | |
# config push -u origin master |
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
#!/bin/bash | |
# | |
# This are the instructions to install (or copy) the dot files | |
# in a new environment | |
git clone --bare <git-repo-url> $HOME/.myconfs | |
# Create alias to interact with the config directory | |
# It also should go in a .bash_profile and/or .bashrc files | |
alias config='git --git-dir=$HOME/.myconfs/ --work-tree=$HOME' | |
# In Windows this can help | |
# git --git-dir=%USERPROFILE%\.myconfs --work-tree=%USERPROFILE% | |
# Use alias to checkout from the remote repo | |
# This may fail if some of the dotfiles already exist. Back them up | |
# and delete them | |
config checkout | |
# Use the alias to configure local repository to not show untracked files | |
config config --local status.showUntrackedFiles no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment