Giter Site home page Giter Site logo

how-to-dotfiles's Introduction

How to dotfiles

I am going to explain a good method to manage dotfiles (best is arguable). I use the git bare repos method.
A git bare repo is basically a git repo without a definite tree, and the contents of its .git lives in a folder that you decide yourself.

First, create the git repo where you want, it can be in ~ but it could be anywhere else if you like having your home uncluttered. I personally put it in ~/src which is a folder that contains my repositories.

git init --bare ~/dots

This will create the bare repo, with what you'd usually expect to be in a .git in it.

Now create an git alias that will be used to address your dots repo with your ~ as the tree. For this, add something along the lines of

alias dots="git --git-dir=$HOME/dots --work-tree=$HOME"

in your shellrc file.

At this point, pretty much everything is ready, except that it's not easy to keep track of the files that you actually want shown in your dotfiles repo.
For this, I use what I call a trackfile that I store in my config folder (~/etc for me) and I put everything that I want listed in it.
Mine looks like this

bin/

etc/bspwm/
etc/dunst/
etc/home.d/
etc/gtk-3.0/
etc/nvim/init.vim
etc/nvim/coc-settings.json
etc/picom/
etc/sh/
etc/sxhkd/
etc/wal/
etc/xorg.d/
etc/pythonrc
etc/trackfile

var/local/share/applications/

.profile

When I want to commit my dotfiles I can do dots add $(cat etc/trackfile), then dots commit -m "update". If I need to remove a file from my dotfiles (which is not that common), I just unlist the file then delete it from the repo with dots rm --cached ~/path/to/file.

If you are lazier...

I've made a little tool in dots/ directory to make everything nicely for you.

how-to-dotfiles's People

Contributors

aosync avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 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.