Skip to content

Instantly share code, notes, and snippets.

@dbalatero
Last active June 18, 2019 17:07
Show Gist options
  • Save dbalatero/f814b0397d8503605ec0ff84226c861b to your computer and use it in GitHub Desktop.
Save dbalatero/f814b0397d8503605ec0ff84226c861b to your computer and use it in GitHub Desktop.

To start tracking dotfiles in git:

Create a dotfiles repo

cd $HOME
mkdir .dotfiles
cd .dotfiles
git init .

Create the two files in this gist

# Copy the setup code to clipboard first
pbpaste > setup
chmod +x setup

mkdir shared
# Copy the symlinks.sh code to the clipboard
pbpaste > shared/symlinks.sh

Commit and push

# make a dotfiles repo on github
git remote add origin <your repo url>
git add .
git commit -m 'first commit'
git push -u origin master

Move your first dotfiles over:

cd ~/.dotfiles
mv ~/.bashrc bashrc
mv ~/.bash_profile bash_profile

# Make sure there aren't secret keys in your dotfiles!!!!
# 🚨

Add two lines to your setup script:

symlink_dotfile bashrc ~/.bashrc
symlink_dotfile bash_profile ~/.bash_profile

Run setup so that the dotfiles in your repo are symlinked in your home dir

./setup

Commit and push

git add . && git commit -m "Moved bash shell files to dotfiles"
git push
#!/usr/bin/env bash
source "${BASH_SOURCE%/*}/shared/symlinks.sh"
# Add any setup for your dotfiles under this line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment