Skip to content

Instantly share code, notes, and snippets.

@sragu
Created August 21, 2011 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sragu/1160309 to your computer and use it in GitHub Desktop.
Save sragu/1160309 to your computer and use it in GitHub Desktop.
mkdir -p ~/Dropbox/git-repo/dotfiles.git
cd ~/Dropbox/git-repo/dotfiles.git
git init --bare
cd ~/projects
projects $ git clone ~/Dropbox/git-repo/dotfiles.git
Cloning into dotfiles...
done.
projects $ cd dotfiles/
dotfiles(master) $
dotfiles (master) $ cp -pr ~/.ssh .
dotfiles (master) $ git ci -am" initial commit"
#name: deploy.sh
# move the dot files to home
#!/bin/sh
git ls-files | grep "^\\." | xargs -n1 -I{} cp -prfv {} ~/{}
#name: update.sh
#move the updated dot files back to the local repository
#!/bin/sh
git ls-files | grep "^\\." | xargs -n1 -I{} cp -prfv ~/{} {}
git clone ~/Dropbox/git-repo/dot-files.git
#copy the local dotfiles to repo.
./update.sh
#stash them if you want to bring them back
git stash
#deploy the repo dot files to home directory.
./deploy.sh
#alternative approach.
#copy to the repo
./update.sh
# diff the change to understand what your are adding or taking away from existing dot files
git diff
#once you have reviewed the changes and ready to go.
git branch -b <machine-name> master
git ci -am"merged changes"
#deploy the new branch to home directory
#Don't forget to push your changes to remote after any changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment