Please, see Greg\'s answer.
I do not understand Daniel\'s statement at the thread completely:
Why are you manually copying files around
I believe what Daniel was referring to is using Git to manage the files in particular directories in place, without copying them around. For example, starting without any Git repository, you might:
cd ~/bin
git init
git add .
Now, your ~/bin
directory contains a ~/bin/.git
repository and you can git add
and git diff
right from the ~/bin
directory.
1) I back up my .dotfiles as follows:
a) Create a directory ~/dotfiles
b) link dotfile into ~/dotfiles/ e.g.
ln ~/.bashrc ~/dotfiles/.bashrc # NB Must be hard links
c)
cd ~/dotfiles
git init
git add .
git commit -m "Initial commit of dotfiles"
2) You can also refer to a Git repo not in the current directory tree by exporting the environment string GIT_DIR .e.g (assuming at repo at ~/myrepos/repo1)
a)
export GIT_DIR=~/myrepos/repo1/.git
b)
git add .profile
git commit -m "added .profile"
Does that help at all?