Putting your .bash_profile in git
If you spend several hours a day in Terminal, and you created a bunch of
alias commands like
alias gs='git status' to make your life just a little faster. Then why not commit that good work to version control, and potentially help others.
Incase disaster strikes and you need to reinstall your OS, you won't lose all those handy shortcuts you've created over the years.
First thing you need to do is create a directory in your home folder, and
mkdir bash_profile cd bash_profile git init
Now lets add that
git status alias, and commit the file.
echo 'alias gs="git status"' >> .bash_profile git add . git commit -m "init bash_profile repo"
You'll need to create the
bash_profile repo over on github, then you can add the remote, and push to master.
git remote add origin https://github.com/YOUR_NAME/bash_profile.git git push -u origin master
Once you've done that all thats left to do is point the 'actual' .bash_profile to your new version controlled one. This is done by using
cd; echo "source ~/bash_profile/.bash_profile" >> .bash_profile
Now you're all set! All thats left to do is to add some
alias shortcuts, or
functions if you're feeling adventurous, and push to master.
P.S. Rember to restart your terminal everytime you edit your .bash_profile to see the changes.