Thanks for putting together this video! I read that article, and then searched on UA-cam to see if someone could explain it better. Showing the normal repo and bare repo side by side was what I was looking for. Your explanation, and walking through actually using it made it make sense!
New to github and using git to manage my dotfiles, suckless builds, etc... basically the stuff I’m tired of making from scratch each time I move to a new system. 😂 I’ve had to watch this video a few times to really understand how this is working.. Now that I understand I just have to say this is the most elegant and clean solution I’ve seen. Much better than GNU/stow or traditional methods. Excited to soon be living in a world where I can git-clone a github repo on a brand new system and have everything be how I like it, from window manager to vim rc. Thanks for this video. Really appreciate what you’re doing @distrotube 🙏🏻 Also- my dads side of the family all lives in West Monroe. He has a house out there on the same land as his brother and step-dad. Beautiful place. I like it much more there than So Cal.
Thanks a bunch. Excellent way to manage dotfiles. I'm quite good at git but i didn't know you could use it like this so much better than symlinking everything
My .vimrc file has become one of the most valuable and irreplaceable files on my computer and having a backup is essential. I've have a really inefficient git backup setup currently, but this video is exactly what I've been looking for for months. Excited to implement it. Especially now that I started using linux and I'm creating even more valuable/ irreplaceable dot files.
Tip: use 'exec bash' or 'exec zsh' as it works better than just sourcing the .bashrc .zshrc or launching a new instance of the shell within a shell. Especially if you are doing it a lot as you build your dotfiles.
imo you should retitle this video That the clone is bare isn't really important here-- all it means is that wherever you clone (or initialize) it, Git will store all the repo metadata but not check out any version of the contents of the repo in that directory. The real workhorse here is the git-worktree feature, and you can use it with any repo to create a working tree in another directory, and you can have as many of them as you want.
@@cc-hc1dr you can use any repo you want, including one you've already cloned. Just make sure you have git worktree and see the man page. There might be a tldr page as well
@@vpxc I think you could have put more effort to give a good example. Your example doesn't help me understand what you were talking about at all. DT's on the other hand, shows how it works very well.
@pxc It's not possible to use git-worktree feature for the dotfiles because git won't allow you to create the worktree in the existing home directory (~) `cd /gitrepo && git worktree add --force ~`
thanks a lot! I knew there would be a solution like this. For some reason, I made my dotfile repos in the same way as it were in the home directory, having each filesin their corresponding directory folders and whatnot. surprisingly, after applying what you showed in your video, cloning from my repo was a breeze, and everything just fits perfectly after cloning! and it was indeed a hassle symlinking each one of them from their corresponding folder. but then I knew this can be done, which is indeed better than my first option, which is to turn the entire home directory as a git repo, which would be a hassle. I never knew this option can be done! really helped a lot!
DT , you should do a video on ' etckeeper ' straight from the default repos. A VCS for all of your etc config files , it keeps logs of all changes and it has its own set of commands which are actually very similar to git's. Its more automated , every time you update whether its APT or Pacman it lets you know all of the changes being logged in the output.
@@BillGarrett Will git know to spread those out to the correct system locations or will it just put them in one place? Edit: For stumbling onto this now, I highly recommend a stow based approach for dotfiles. There's a great video on it by "Dreams of Autonomy". Quite a bit cleaner imo
@@readmore8974 If you're using his "config" alias at 9:19 it will put the files in whatever directory was given to --work-tree. In his example that's $HOME
One downside I found with this method: you can't add a README file without having said file sitting in your home directory. Otherwise this is 100% the lowest-friction "dotfiles repo" setup I've heard of, and I can't see myself going back to another method.
⚠️ BE CAREFULL EVERYBODY WHO'S GONNA USE THAT METHOD... ⚠️ I did 'config reset --hard' to my repo and that ALMOST killed all my configs. If you have done like that you still can get back to the last commit: check 'config reflog' and then 'git reset --hard ' back to the last commit.
Thanks, perhaps a little more information was needed for newbies to get their dotfiles published. I used dotfiles as my alias because "dotfiles status" makes a lot more sense than "config status"
Chezmoi is my go-to. Templating and ability to run scripts. Control any file by chezmoi add and begin templating or tracking in one repo, but anything directory can be controlled
that's a VERY nifty trick! what I've been doing with my dotfiles repo is add an init script that would create symlinks and load my submodules. What I call submodules is separate dotfiles repos (I have one for Personal, Work and OS-Specific)
Death to dotfiles! Not only do they clutter your home directory, they are also visible to other users, who can see what sort of apps you use, which is a privacy breach. Luckily, more and more apps are adopting the XDG Base Directory spec , which defines default directories ~/.config/, ~/.local/ and the rest of it to contain these things (and these locations can be overridden by environment variables if you wish). If you are a developer working on an app which needs to create user preference/cache files and the like, and you haven’t already adopted this spec, I urge you to do so!
Sorry I know the reply is late. Why is the home directory accessible to others while ~/.config isn't? Does the latter have a stricter file mode by default in many distros?
For those on Windows, setting an alias might not work. I found you can instead make a custom function like the following: function config { git --git-dir=$HOME/dotfiles --work-tree=$HOME $args }
I like this. Let me add to it. You can undo a ignored file or directory in the .gitignore file by starting the line with a '!'. So if you e.g. don't want to ignore .bashrc and the .config directory in your home directory, just add these three lines after '*'. !/.bashrc !/.config/ !/.config/** So just add every file or directory you want to add with the negate pattern to .gitignore first first. I think this is a lot cleaner this way.
Great timing for me! Yesterday I had just begun to version my dotfiles. The solution I had found was to create a git repositorie in my user's home directory and a .gitignore to ignore all files (*). Then, I whitelisted (!) only the config files I wanted. It worked, but it got a little complicated to mess around with .gitignore when I got into folder structures (like things inside .config, in witch there were files I wanted to version, and files I didn't, in diferent folders and diferent levels). And of course, anything outside of the user's home directory would be out of versioning or in a simbolic link mess. Glad you showed this solution, much more elegant indeed! Will be using it instead.
@@bitnatures I have a git + stow setup for config files in home, and another separated setup for all manual changes I make to files in /etc/ (and etckeeper to track automatically all changes made to all files in /etc)
I prefer using the "ba-bam+bp" workflow for adding dotfiles, essentially instead of the alias being "config" I've set it to "b" for the git bare command in the video, "ba" for "(git bare) add" to add tracking to any new files, and "bam" for "(git bare) commit -am" then "bp" for "git Bare) push"
the bare repository doesn't mean anything, if your existing repo was created without the `--bare` flag and is named "dotfiles" you can repeat this trick by aliasing `git --git-dir=$HOME/dotfiles/.git ...`. the real focus should be on the `--work-tree` flag which I would actually set to $PWD, that way you can add configuration files from all over the place, like in ~/.config, without adjusting the alias at all
That would defeat the purpose of preserving the directory structure, thereby making a new install as simple as cloning the repository (and maybe moving the work tree to $HOME).
@@Maldito011316 it's a little bit of a pain when you're trying to check git status, because you will be confronted by a list of all the files you didn't add.. I used it for a while but I think using symlinks GNU Stow might be less painful, still have to try it tho
Thanks for this. I'd be doing mine the same as you with symlinks. I set my dotfiles up like this, and I have to say after some getting use to I really like it allot better. I like that all of the config file directory structure is preserved in the remote branch. That will make things allot less hassle when installing to another computer, or refreshing my own computer.
I'm not sure if I am just missing something or what. It's probably due to me not being as familiar with git as I should be. When I go to run "config push" it throws the following: fatal: No configured push destination. Either specify the URL from the command-line or configure a remote repository using git remote add and then push using the remote name git push
The drawback of this method is that you can not access the `diff` of your dotfiles locally. That is only possible after commit and push the modifications to the remote repository.
Of course you can. When you make a change locally, just use config diff before you commit. If you want to compare changes between commits, you can use config diff HEAD~1 HEAD for example
@@allegoricalstatue You can hide the README.md in a .github directory on ~/ (help.github.com/en/github/creating-cloning-and-archiving-repositories/about-readmes)
Great stuff DT! I took it a step further by adding a line to my nightly cron jobs to automatically look for changes and push. Nicely done! "config commit -a -m "nightly" && config push github.com/MY_NAME/MY_REPO.git"
I have taken to the symlink method however I automated it. In my "dotfiles" folder (which I actually just call "home" I replicate the folder structure for every tracked config file and I have a bash script in the root of my repo that searches through reporoot/home/ and symlinks it into place to my actual home (creating directories if they dont exist).
Thanks for this; it is an elegant solution like you mention. I don't know what I am missing, but when I move to a directory, I can commit a file added, get a message: "Your branch is up to date with 'origin/main .'nothing to commit (use -u to show untracked files)."
i mean you could always provide a directory of where you want to put the files like git clone pathtoyour.repo/ DIR replace DIR with your desired directory like git clone example.com ./ (clone it to the current folder) or git clone example.com $HOME (clone it to your home directory)
in a normal git repo you have the working directory "project/" and the "project/.git/" directory, the .git is the git repo and it is the contents of a bare repo.
Great video but I spent hours trying to figure out how to push this to remote github repo 😄 had some issue with branch names and understanding the whole process in general
I tried to get this working, but I couldn't. I'll have to use the simlink method until I find out why. Although I don't know yet how I'm going to find out without trying again. It kind of feels like that song titled There's a Hole in The Bucket.
I had the same question in mind. The following worked for me: 1) Create the alias: alias config="git --work-tree $HOME --git-dir $HOME/dotfiles" 2) Initialize the bare-repo and add the original repo as an remote-repository: config init config remote add -t \* -f origin 3) to put all the dotfiles into your $HOME just checkout your branch: config checkout master Hope it helps someone!
I am using the fish shell and when I try to use config I get an error "fatal: not a git repository '/home/myname/dotfiles/'" what could I be doing wrong?
you should really also try etckeeper. BTW I tried dotbare but in the end, I just use a standard git repo in my home dir. No downfalls and better integration with existing tools
instead of setting showUntrackedFiles to no i keep it normal and instead filter with an .gitignore file. So i automatically track files in specific subdirectories
Hi! I like this method, but come into some problems when i try to get my configs on a new machine. Things just look weird. Can somebody please give me a proper way to do it with such method?
Well then when you upload it anyone can take your entire system and replace use it as well. They would also probably know every file program and image that you have on your computer unless you remove them manually. Other then that it would be unnecessary.
I think I still prefer dotbot but I'll give this a look. I am not sure this solution will be as flexible as I need it to be. Using the settings.json example you provided, Iwould have no idea what that file pertained to if I didn't put it in the commit message; seems way better to just have dotfiles/config//settings.json -> ${XDG_CONFIG_HOME}//settings.json by just adding an entry for it into install.config.yaml and running dotbot-install.
I did this, then cloned my dotfiles repository to a new machine, but this broke my .bashrc alias. For some reason even tho the repo was cloned into $HOME/dotfiles the alias no longer recognizes it as a git repo when using the alias. Inside the $HOME/dotfiles dir it is recognized by a simple git status command, but the alias doesn't work.
If you just clone your dotfiles repo, move the .git directory to ~, delete the clone, and do git reset --hard in ~ you can avoid the config alias. Your ~ is the working copy. Then as someone mentioned .gitignore * and use git add -f. Then you can just use git normally.
I have a question, I backup up everything I needed and then distrohopped. How do I clone the repository so that it has the same functionalities? i.e. I can "config add x.file" and it will work perfectly. The only way I managed to do it was deleting the repo and following the tutorial again.
Why can't we just "git" the entire .config folder ? Wouldn't that be a simpler way. My _.config folder /repo_ is about 250 mb. Granted you make have to symlink a few files like .bashrc which reside outside of .config but the majority of files sit inside .config.
This seems like a great new thing to try out! However, I'm confused as to how one would go about setting up a new machine if they were to reuse the same dotfiles. Would they not have to do any moving / copying / symlinking?
I’m a Linux (Mint) newbie and am aware of what dotfiles are, but am clueless as to why you have to “manage” them. Also, is the point of this video to show us how to backup these dotfiles? Guess I’m way in over my head here.
the idea of managing them is #1 to backup all your important settings stored in dotfiles #2 if switching between different computers and virtual machines to easily reload the backup this obv saves a lot of setup time and also makes it simple to try out different config setups espc for heavily config'd uses like mail accounts and news and media feeds
Hey, DT! do you think it's possible to bring this to a bigger scale ? I mean, what if we make git bare repository for the whole system on empty , freshly installed distro and call it main, then we can create another branch and call it kde, install and configure kde afterwards , and commit changes to kde branch , and then again we go checkout our main branch, and do the same for , say , dwm, or i3 , or xfce even. See where I'm going with this ? Or how about we use another branch and call it thinkpad-x201, on a fresh arch linux install, then we configure everything we need for this machine (media keys, stylus support (if any) , fingerprint sensor, hibernation and so on) , we can then checkout main branch on another machine , say thinkpad-x61 , and do the same, now we made our selves custom distro, may i say, that can be used on any of our machines, and we can just install official distro on any machine as always , install just git and then clone our custom distro repository , and that's it , no more messing around with different distros, desktop environments (we all know how messy it becomes if you have more than one DE), you just install your favorite distro , as usual , and use your own configuration of that, suitable for current machine and god knows what else you can do with it, and more over, it's a back up system for your whole system , out of the box ! imagine installing some program that can make serious changes to your system ( not so hard to imagine having AUR under your hand , huh) , you prepare a commit -m "restore point: before installing dangerous software" , you install the software , your system crashes , as it should , but , you just boot from some live linux usb , or if it's just GUI, or graphics that failed we can do it even without live usb, chroot to your system , and roll back to your previous commit , boom this house is clear! Any way, why am I even writing this ? Well , I see the possibility but I'm not quite sure how to do this. Any chance you can get involved, or advise on this, what so ever ?
Lmao i used to tar these files and upload then onto mega like every week xD
NOOOOOOOOOOOOO 💀💀💀💀
Oh my god
lol
OH NOOOOOOOO 💀💀💀💀
The maddest of lads
Thanks for putting together this video! I read that article, and then searched on UA-cam to see if someone could explain it better. Showing the normal repo and bare repo side by side was what I was looking for. Your explanation, and walking through actually using it made it make sense!
New to github and using git to manage my dotfiles, suckless builds, etc... basically the stuff I’m tired of making from scratch each time I move to a new system. 😂
I’ve had to watch this video a few times to really understand how this is working.. Now that I understand I just have to say this is the most elegant and clean solution I’ve seen. Much better than GNU/stow or traditional methods.
Excited to soon be living in a world where I can git-clone a github repo on a brand new system and have everything be how I like it, from window manager to vim rc.
Thanks for this video. Really appreciate what you’re doing @distrotube 🙏🏻
Also- my dads side of the family all lives in West Monroe. He has a house out there on the same land as his brother and step-dad. Beautiful place. I like it much more there than So Cal.
Awesome! I was just about to restart my dotfiles and was already dreading the symlinking management I would have. Thank you!!!
Thanks a bunch. Excellent way to manage dotfiles. I'm quite good at git but i didn't know you could use it like this so much better than symlinking everything
My .vimrc file has become one of the most valuable and irreplaceable files on my computer and having a backup is essential.
I've have a really inefficient git backup setup currently, but this video is exactly what I've been looking for for months.
Excited to implement it.
Especially now that I started using linux and I'm creating even more valuable/ irreplaceable dot files.
Tip: use 'exec bash' or 'exec zsh' as it works better than just sourcing the .bashrc .zshrc or launching a new instance of the shell within a shell. Especially if you are doing it a lot as you build your dotfiles.
what's the difference?
3 years later… Use GNU Stow to manage dotfiles. It does most of it for you.
Or you could alias editing and sourcing such as ebash to edit and sbash to source. Very convenient.
imo you should retitle this video
That the clone is bare isn't really important here-- all it means is that wherever you clone (or initialize) it, Git will store all the repo metadata but not check out any version of the contents of the repo in that directory.
The real workhorse here is the git-worktree feature, and you can use it with any repo to create a working tree in another directory, and you can have as many of them as you want.
can you give a link to a working example?
@@cc-hc1dr you can use any repo you want, including one you've already cloned. Just make sure you have git worktree and see the man page. There might be a tldr page as well
@@vpxc I think you could have put more effort to give a good example. Your example doesn't help me understand what you were talking about at all. DT's on the other hand, shows how it works very well.
@@Neko-kun-dp1hq you should do some digging yourself which is clearly what pxc has done
@pxc It's not possible to use git-worktree feature for the dotfiles because git won't allow you to create the worktree in the existing home directory (~)
`cd /gitrepo && git worktree add --force ~`
I am always learning something new every time I watch your show! Also, congratulations on your Saints winning on Sunday!
Nice. Well-edited and informed Linux content that’s useful for both new and experienced Linux users. Surprisingly rare on UA-cam. Thank you!!
Thanks, Mitchel.
I think this is the cleanest way to do this task. The neat part is that one can track dotfiles in root or nested folders at the same time.
thanks a lot! I knew there would be a solution like this. For some reason, I made my dotfile repos in the same way as it were in the home directory, having each filesin their corresponding directory folders and whatnot. surprisingly, after applying what you showed in your video, cloning from my repo was a breeze, and everything just fits perfectly after cloning! and it was indeed a hassle symlinking each one of them from their corresponding folder. but then I knew this can be done, which is indeed better than my first option, which is to turn the entire home directory as a git repo, which would be a hassle. I never knew this option can be done! really helped a lot!
Yeah this method is really awesome, I use it for some time now. Can't live without it.
Yea, can't believe I hadn't heard of this before now.
DT , you should do a video on ' etckeeper ' straight from the default repos. A VCS for all of your etc config files , it keeps logs of all changes and it has its own set of commands which are actually very similar to git's. Its more automated , every time you update whether its APT or Pacman it lets you know all of the changes being logged in the output.
Wow, this tutorial is very self-explanatory and very informational. Thank you sooo much! :)
This is the most convenient method I've seen so far. Great video!
Excellent explanation, and a big thanks for referencing back to the Atlassian article. Love your content!
Really cool of you to credit the author of the article you got the idea from, respect!
Great video. Would have liked to have seen you sync a few Dev machines off the bare repo - especially with different OS (folder locations)
but how would you clone in it in a fresh system?
git clone --bare repository-location local-dotfiles-location
@@BillGarrett Will git know to spread those out to the correct system locations or will it just put them in one place?
Edit: For stumbling onto this now, I highly recommend a stow based approach for dotfiles. There's a great video on it by "Dreams of Autonomy". Quite a bit cleaner imo
@@readmore8974 If you're using his "config" alias at 9:19 it will put the files in whatever directory was given to --work-tree. In his example that's $HOME
This video is excellent, by far this is my favorite method to manage dotfiles
It's just the, bare repository, the simple bare repository, forget about your worries and your strife
Just had my bare dotfiles repo. DT you're awesome. Thanks man
One downside I found with this method: you can't add a README file without having said file sitting in your home directory. Otherwise this is 100% the lowest-friction "dotfiles repo" setup I've heard of, and I can't see myself going back to another method.
⚠️ BE CAREFULL EVERYBODY WHO'S GONNA USE THAT METHOD... ⚠️ I did 'config reset --hard' to my repo and that ALMOST killed all my configs. If you have done like that you still can get back to the last commit: check 'config reflog' and then 'git reset --hard ' back to the last commit.
This is what I was worried about. Will `git clean -fdx` remove all untracked files ?
Thanks, perhaps a little more information was needed for newbies to get their dotfiles published. I used dotfiles as my alias because "dotfiles status" makes a lot more sense than "config status"
Great explanation as always. If you got around to recording a video about etckeeper, that would be also much appreciated.
Chezmoi is my go-to. Templating and ability to run scripts. Control any file by chezmoi add and begin templating or tracking in one repo, but anything directory can be controlled
that's a VERY nifty trick!
what I've been doing with my dotfiles repo is add an init script that would create symlinks and load my submodules. What I call submodules is separate dotfiles repos (I have one for Personal, Work and OS-Specific)
Death to dotfiles! Not only do they clutter your home directory, they are also visible to other users, who can see what sort of apps you use, which is a privacy breach.
Luckily, more and more apps are adopting the XDG Base Directory spec , which defines default directories ~/.config/, ~/.local/ and the rest of it to contain these things (and these locations can be overridden by environment variables if you wish). If you are a developer working on an app which needs to create user preference/cache files and the like, and you haven’t already adopted this spec, I urge you to do so!
Sorry I know the reply is late. Why is the home directory accessible to others while ~/.config isn't? Does the latter have a stricter file mode by default in many distros?
For those on Windows, setting an alias might not work. I found you can instead make a custom function like the following:
function config {
git --git-dir=$HOME/dotfiles --work-tree=$HOME $args
}
I just gitignore every file with "*" and then use git add -f with each file I want to track.
I like this. Let me add to it. You can undo a ignored file or directory in the .gitignore file by starting the line with a '!'. So if you e.g. don't want to ignore .bashrc and the .config directory in your home directory, just add these three lines after '*'.
!/.bashrc
!/.config/
!/.config/**
So just add every file or directory you want to add with the negate pattern to .gitignore first first. I think this is a lot cleaner this way.
@@BlackM3sh I never knew that was a possibility, thanks I'll try it out.
@@BlackM3sh ohw both /.config/ _and_ /.config/* is neccesary imma try this
that would have been my first idea
Great timing for me! Yesterday I had just begun to version my dotfiles.
The solution I had found was to create a git repositorie in my user's home directory and a .gitignore to ignore all files (*). Then, I whitelisted (!) only the config files I wanted. It worked, but it got a little complicated to mess around with .gitignore when I got into folder structures (like things inside .config, in witch there were files I wanted to version, and files I didn't, in diferent folders and diferent levels).
And of course, anything outside of the user's home directory would be out of versioning or in a simbolic link mess.
Glad you showed this solution, much more elegant indeed! Will be using it instead.
what would you need to version outside of HOME? most unix programs should respect a user config. Just curious.
@@bitnatures I have a git + stow setup for config files in home, and another separated setup for all manual changes I make to files in /etc/ (and etckeeper to track automatically all changes made to all files in /etc)
I prefer using the "ba-bam+bp" workflow for adding dotfiles, essentially instead of the alias being "config" I've set it to "b" for the git bare command in the video, "ba" for "(git bare) add" to add tracking to any new files, and "bam" for "(git bare) commit -am" then "bp" for "git Bare) push"
the bare repository doesn't mean anything, if your existing repo was created without the `--bare` flag and is named "dotfiles" you can repeat this trick by aliasing `git --git-dir=$HOME/dotfiles/.git ...`. the real focus should be on the `--work-tree` flag which I would actually set to $PWD, that way you can add configuration files from all over the place, like in ~/.config, without adjusting the alias at all
That would defeat the purpose of preserving the directory structure, thereby making a new install as simple as cloning the repository (and maybe moving the work tree to $HOME).
I agree with everything but using pwd. It wouldn't work smoothly
@@Maldito011316 yeah I no longer use this technique, I think GNU Stow might be better
@@jasperzanjani It's a very elegant solution!
@@Maldito011316 it's a little bit of a pain when you're trying to check git status, because you will be confronted by a list of all the files you didn't add.. I used it for a while but I think using symlinks GNU Stow might be less painful, still have to try it tho
Thanks for this. I'd be doing mine the same as you with symlinks. I set my dotfiles up like this, and I have to say after some getting use to I really like it allot better. I like that all of the config file directory structure is preserved in the remote branch. That will make things allot less hassle when installing to another computer, or refreshing my own computer.
This has blown my mind, and was posted 4 years ago. Bruhh, how I don´t have seem that before
Actually you can 'source .bashrc' instead of relaunching shell
And at the end, just setup a ssh key and add remote, so that you can push in 1 command
But if that ssh key has passphrase, then he has to type it also.
@@abaumarabahilal1189 you can store password for ssh key with commands ssh-agent and ssh-add
@@artslob Yep, gnome-keyring, kde-wallet, etc. will do heavy lifting :-)
UA-cam kept recommending me your videos and I enjoyed them a lot so far, so I just subscribed ;-)
By the way, you can create git alias instead of bash: git config --global alias.config="--git-dir=$HOME/dotfiles --work-tree=$HOME"
I'm not sure if I am just missing something or what. It's probably due to me not being as familiar with git as I should be.
When I go to run "config push" it throws the following:
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using
git remote add
and then push using the remote name
git push
Jaw on the floor. /me Going to redo my dotfiles repo... Thanks, DT!
The drawback of this method is that you can not access the `diff` of your dotfiles locally. That is only possible after commit and push the modifications to the remote repository.
Of course you can. When you make a change locally, just use config diff before you commit. If you want to compare changes between commits, you can use config diff HEAD~1 HEAD for example
Great, really interesting alternative! Btw, you can clean terminal with Ctrl+l, it's a bit faster :)
What do you do with the README.md file? Do you have to keep the README.md file in your home?
Hah I have the exact same question. currently I just have a README.md in ~/ :/
@@allegoricalstatue You can hide the README.md in a .github directory on ~/ (help.github.com/en/github/creating-cloning-and-archiving-repositories/about-readmes)
@@LordZultair I didn't know that. Thanks
This method is super legendary.
Thanks DT otherwise I will have a gitignore file with tones of thing in that
Great stuff DT! I took it a step further by adding a line to my nightly cron jobs to automatically look for changes and push. Nicely done! "config commit -a -m "nightly" && config push github.com/MY_NAME/MY_REPO.git"
Sweet!
Very useful and convinient. Thank you.
I have taken to the symlink method however I automated it. In my "dotfiles" folder (which I actually just call "home" I replicate the folder structure for every tracked config file and I have a bash script in the root of my repo that searches through reporoot/home/ and symlinks it into place to my actual home (creating directories if they dont exist).
Damn, this is actually really cool
Thank you very much. Amazing video!
Thanks DT! just set one of these up in my shiny new GitLab account!!!
This is brilliant! 🎉
What a cool use case you 👌🏻, wonderful 😀 🙏🏻
Thanks for this; it is an elegant solution like you mention.
I don't know what I am missing, but when I move to a directory, I can commit a file added, get a message:
"Your branch is up to date with 'origin/main
.'nothing to commit (use -u to show untracked files)."
Thanks! Still valid! works for me!
how does one clone this repo onto a new machine? If I do a normal `git clone` it just has all of the files in a single directory
i mean you could always provide a directory of where you want to put the files like git clone pathtoyour.repo/ DIR replace DIR with your desired directory like git clone example.com ./ (clone it to the current folder) or git clone example.com $HOME (clone it to your home directory)
I gotta ask- does the laptop in the background exist only for the sole purpose of running cmatrix?
Thanks for sharing your approach of storing dotfiles. I've audaciously adapted this for myself now :-)
NICE! This is so, so much easier. Thank you!
in a normal git repo you have the working directory "project/" and the "project/.git/" directory, the .git is the git repo and it is the contents of a bare repo.
Great video but I spent hours trying to figure out how to push this to remote github repo 😄 had some issue with branch names and understanding the whole process in general
You did good, learning basic git(hub) use normally takes days to learn. 😀
This is super helpful and useful, thanks!
I ended up calling my alias 'dgit' because it's shorter and more descriptive.
Very useful, thanks DT.
Thanks!!! Great solution for me.
Pretty handy. Saved it in a playlist for future reference.
It's really cool solution! Thank you man! I know want I going to do tomorrow morning;)
Thank you, I will start using this method myself.
I tried to get this working, but I couldn't. I'll have to use the simlink method until I find out why. Although I don't know yet how I'm going to find out without trying again. It kind of feels like that song titled There's a Hole in The Bucket.
How would you add a readme to the new dotfiles repo? It is not part of the dotfiles but also necessary to document how to setup certain dependencies
What would the process be for a fresh install, would cloning the repo put the dotfiles in the correct directories?
I would assume that yes, is like another repo, but with this one your $HOME is also the repo's working directory.
Just create a new 'alias config(...)' in your bashrc and try 'config checkout' command. If there were any error, remove or back up conflict files.
I had the same question in mind. The following worked for me:
1) Create the alias:
alias config="git --work-tree $HOME --git-dir $HOME/dotfiles"
2) Initialize the bare-repo and add the original repo as an remote-repository:
config init
config remote add -t \* -f origin
3) to put all the dotfiles into your $HOME just checkout your branch:
config checkout master
Hope it helps someone!
I may have just spent a day writing a script to do all the sync... The good thing is I learned bash.
why not just rsync all the dotfiles to a safe place and make backup and restore on a new system?
How do I move my dotfiles to anothe machine and restore files ?
I am using the fish shell and when I try to use config I get an error "fatal: not a git repository '/home/myname/dotfiles/'" what could I be doing wrong?
Everything had worked with me exept the config push command, git didn't know where to posh the file, and it asked for something it called upstream!
I had that too, I fixed it by doing this: config push --set-upstream git@gitlab.com:myusername/dotfiles.git master
you should really also try etckeeper. BTW I tried dotbare but in the end, I just use a standard git repo in my home dir. No downfalls and better integration with existing tools
I like this approach, but how would you handle scripts that install a set of applications? In a separate directory called e.g. `.setup`?
instead of setting showUntrackedFiles to no i keep it normal and instead filter with an .gitignore file. So i automatically track files in specific subdirectories
Why can't we simply hardlink files and have a cron job git-push it every week?
Hi! I like this method, but come into some problems when i try to get my configs on a new machine. Things just look weird. Can somebody please give me a proper way to do it with such method?
What if you make the whole root folder a repository?
Well then when you upload it anyone can take your entire system and replace use it as well. They would also probably know every file program and image that you have on your computer unless you remove them manually. Other then that it would be unnecessary.
I think I still prefer dotbot but I'll give this a look. I am not sure this solution will be as flexible as I need it to be. Using the settings.json example you provided, Iwould have no idea what that file pertained to if I didn't put it in the commit message; seems way better to just have dotfiles/config//settings.json -> ${XDG_CONFIG_HOME}//settings.json by just adding an entry for it into install.config.yaml and running dotbot-install.
I did this, then cloned my dotfiles repository to a new machine, but this broke my .bashrc alias. For some reason even tho the repo was cloned into $HOME/dotfiles the alias no longer recognizes it as a git repo when using the alias. Inside the $HOME/dotfiles dir it is recognized by a simple git status command, but the alias doesn't work.
if I generate .gitignore file with everything else selected than my dotfiles, am I able to do " add ."?
I just make my whole system a git repo and when ever I mess up my system I revert the last commit :gigabrain:
If you just clone your dotfiles repo, move the .git directory to ~, delete the clone, and do git reset --hard in ~ you can avoid the config alias. Your ~ is the working copy. Then as someone mentioned .gitignore * and use git add -f. Then you can just use git normally.
I have a question, I backup up everything I needed and then distrohopped. How do I clone the repository so that it has the same functionalities? i.e. I can "config add x.file" and it will work perfectly. The only way I managed to do it was deleting the repo and following the tutorial again.
Use "stow" to automagically symlink to your dotfiles directory.
Greatly explained!
Why can't we just "git" the entire .config folder ? Wouldn't that be a simpler way. My _.config folder /repo_ is about 250 mb. Granted you make have to symlink a few files like .bashrc which reside outside of .config but the majority of files sit inside .config.
That could be very useful. Thanks for the video.
This seems like a great new thing to try out! However, I'm confused as to how one would go about setting up a new machine if they were to reuse the same dotfiles. Would they not have to do any moving / copying / symlinking?
I’m a Linux (Mint) newbie and am aware of what dotfiles are, but am clueless as to why you have to “manage” them. Also, is the point of this video to show us how to backup these dotfiles? Guess I’m way in over my head here.
the idea of managing them is #1 to backup all your important settings stored in dotfiles #2 if switching between different computers and virtual machines to easily reload the backup
this obv saves a lot of setup time and also makes it simple to try out different config setups
espc for heavily config'd uses like mail accounts and news and media feeds
I still have to add them one by one right? I wanted to add my .config and it started adding tons of cache files for some reason
Hey, DT! do you think it's possible to bring this to a bigger scale ? I mean, what if we make git bare repository for the whole system on empty , freshly installed distro and call it main, then we can create another branch and call it kde, install and configure kde afterwards , and commit changes to kde branch , and then again we go checkout our main branch, and do the same for , say , dwm, or i3 , or xfce even. See where I'm going with this ? Or how about we use another branch and call it thinkpad-x201, on a fresh arch linux install, then we configure everything we need for this machine (media keys, stylus support (if any) , fingerprint sensor, hibernation and so on) , we can then checkout main branch on another machine , say thinkpad-x61 , and do the same, now we made our selves custom distro, may i say, that can be used on any of our machines, and we can just install official distro on any machine as always , install just git and then clone our custom distro repository , and that's it , no more messing around with different distros, desktop environments (we all know how messy it becomes if you have more than one DE), you just install your favorite distro , as usual , and use your own configuration of that, suitable for current machine and god knows what else you can do with it, and more over, it's a back up system for your whole system , out of the box ! imagine installing some program that can make serious changes to your system ( not so hard to imagine having AUR under your hand , huh) , you prepare a commit -m "restore point: before installing dangerous software" , you install the software , your system crashes , as it should , but , you just boot from some live linux usb , or if it's just GUI, or graphics that failed we can do it even without live usb, chroot to your system , and roll back to your previous commit , boom this house is clear!
Any way, why am I even writing this ? Well , I see the possibility but I'm not quite sure how to do this.
Any chance you can get involved, or advise on this, what so ever ?
Hey DT, just wanted to check in and see if this is still the way you're managing your dot files?
How do you diff and merge using this technique? I can't figure out a way to use vim-fugitive or any other vim/nvim diff tools because of the alias.
How do you setup a bare repo with gitlab?