I am tracking my dotfiles by using this approach. This is very useful method to track files which are in different locations.

Short summary of the blog.

alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'

dotfiles add newfile
dotfiles commit -am "add new file"

Since it's bash alias, I couldn't fınd the way to integrate this function with magit.


How I can use magit graphical interface like dotfiles-magit-status and look for changed files for this repository?

Kind of function like M-x dotfiles-magit-status is accepted.

Links same approach:

Maybe helps:


1 Answer 1

alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'

I am under the impression that the only "problem" that this solves is that you typically cannot do git clone URL $HOME because $HOME already exists. I recommend you do this instead:

git clone URL /tmp/home
mv /tmp/home/.git $HOME/.git
rm -rf /tmp/home
cd $HOME

The cost of the "dotfiles approach" however is high: you now have to teach Magit and probably many tools to come about this complication. Anyway, if you still want to do it, at https://www.reddit.com/r/emacs/comments/ot92l3 someone else seems to have figured out how to make the pig fly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.