Setting up version controlled bash_profile

Sometimes your roommate spills water on your computer for a second time.

Why would I upload .bash_profile to github?

If you keep your config files uploaded to github, you can avoid having to recreate your dotfiles like .bash_profile every time you need to set up a new computer. For most people, setting up a new computer happens once very rarely, but this also makes it extremely hard when you have to relearn all your bash configuration settings.

What is the version controlled bash_profile strategy?

Step 1: Create a directory specifically for your bash settings 

The directory name could be anything but I use  ~/.bash

This is necessary because you are going to create a git repo and not a single file git gist

Step 2: Create a sample .bash_profile in your new directory

You can add a sample alias such as alias bp="vim ~/.bash_profile"

Step 3: Create a symbolic link to your home directory

$ ln -s ~/.bash/.bash_profile ./bash_profile

Step 4: Create a git repo called .bash , git init and upload your new directory

Done!

What if I encounter a new computer?

Simple!

Step 1: Encounter a new computer

Step 2: Pull down your .bash repo in your home directory

Step 3: Create your symbolic link 

$ ln -s ~/.bash/.bash_profile ./bash_profile

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s