Giter Club home page Giter Club logo

.dotfiles's Introduction

dotfiles

Why versioning only dotfiles if we can do the same with our homedir?

smart way to manage your dotfiles

starting a dotfiles repo

# create your configs dir
cd ~
mkdir dotfiles

# start a git repo
cd ~/dotfiles
git init

# create a git repository for you and get the url
git remote add origin [email protected]:${USERNAME}/${REPO_NAME}.git

# tell git that your worktree starts in your $HOME
git config core.worktree '../../'

# ignore everything
echo '*' > ../.gitignore

# once you're ignoring everything, the only way
# to add files is by using The Force™️
git add -f ../.bashrc
git add -f ../.bash_profile
git add -f ../.vimrc
# etc...

# commit your changes to the remote repo
git commit -m "Initial commit"
git push

getting your dotfiles on a new machine

# go to your home dir
cd ~

# clone the repo with the "--no-checkout" option
# (so we can checkout the files in our homedir)
git clone --no-checkout [email protected]:${USERNAME}/${REPO_NAME}.git

# go to the created directory and do the wortree trick
cd ${REPO_NAME}
git config core.worktree '../../'

# checkout your files overwriting the existing ones
git reset --hard origin/master

notes about gitignoring everything

  • Remember: your .gitignore is ignoring "everything" with that *
  • Anything you want to add must be done with git add -f
  • Your git commands will only work while you're in the ~/${REPO_NAME} directory, so if you want to add a new file, you need to git add -f ../${FILENAME}
  • Once a file was added to the list of tracked files, you don't need to use -f for that file anymore.

inspiration

.dotfiles's People

Contributors

meleu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.