In the home directory there are a bunch of config files that decided to backup them in case of whatever happen.

There are a lot config files especiall under .config directory. For the beginning decided to backup the emacs configs .emacs and .emacs.d/ directory and the .bashrc that includes mostly aliases.

When I am sshing at a vps I will be able to just clone the emacs config repository and voila.

So here is the receipt.

  1. Firstly initialize git repo for the emacs and copy them to different directories, because it is one directory with multiple repositories.
    cd ~
    git init
    cp -rf .git .git-emacs-config
    rm -rf .git
    
  2. And then the same for the bash configs
    git init
    cp -rf .git .git-bash-config
    rm -rf .git
    
  3. Now we have to ignore everything except those files that we need. And we don’t have the luxury of .gitignore currently. So edit the .git-emacs-config/info/exclude by appending the following
*~
.*
*
!.emacs.d
!.emacs.d/*
!.emacs
  1. And then do the same with .git-bash-config/info/exclude
.*
*
!.bash_history
!.bash_logout
!.bash_profile
!.bashrc
!.zlogin
!.zshrce
  1. The only difference now for the git command you have to run ```bash git –git-dir .git-emacs-config add . git –git-dir .git-emacs-config commit -m ‘first commit’ git –git-dir .git-emacs-config push to-your-server ``

That’s it.

Imagine that you can switching branches with different config flavors in an existing home directory, instead of create a new unix user if you want to try different configuration environments 🎉 🎊.