Git Bare Repository - A Better Way To Manage Dotfiles

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ก.ค. 2024
  • I've been looking for a better way to manage my dotfiles. My old method involved moving all of my dotfiles into their own directory and then symlinking each one of them back into the directory structure. What a headache!
    Using git bare repositories, there is no more moving files into an initialized git repository and then creating symlinks. Now, I just add, commit and then push. Done.
    Want to make your own git bare repository? First, make a directory for your new git bare repository (I created one called "dotfiles" but you can name it whatever).
    Then I entered the following in the terminal:
    git init --bare $HOME/dotfiles
    alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME' (add this alias to .bashrc)
    bash
    config config --local status.showUntrackedFiles no
    Basic usage example:
    config add /path/to/file
    config commit -m "A short message"
    config push
    WHAT'S THE REASON FOR THE GIT BARE REPO?
    By using the git bare repo, you can have nested git repos in your home directory and there will not be any issue with keeping things straight. That is the reason for the git bare repo and having an alias ("config").
    ARTICLE REFERENCED IN THE VIDEO:
    📖 developer.atlassian.com/blog/...
    💰 WANT TO SUPPORT THE CHANNEL?
    Patreon: / distrotube
    Paypal: bit.ly/2uTBqXX
    👕 BUY SHIRTS AND MUGS:
    Help support this channel by purchasing these fine t-shirts, hoodies and mugs.
    teespring.com/stores/distrotube
    🗨️ JOIN ME ON DIASPORA AND MASTODON:
    diasp.org/people/792034802a05...
    mastodon.technology/web/accou...
    📁 MY CONFIGS:
    GitLab: gitlab.com/dwt1
    Your support is very much appreciated. Thanks, guys!
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 258

  • @AbduleeFtw
    @AbduleeFtw 4 ปีที่แล้ว +103

    Lmao i used to tar these files and upload then onto mega like every week xD

    • @str0680
      @str0680 3 ปีที่แล้ว +14

      NOOOOOOOOOOOOO 💀💀💀💀

    • @coompiler9029
      @coompiler9029 2 ปีที่แล้ว +6

      Oh my god

    • @RazoBeckett.
      @RazoBeckett. 7 หลายเดือนก่อน +1

      lol

    • @teesh3rt
      @teesh3rt 5 หลายเดือนก่อน +1

      OH NOOOOOOOO 💀💀💀💀

  • @lpanebr
    @lpanebr 4 ปีที่แล้ว +9

    Awesome! I was just about to restart my dotfiles and was already dreading the symlinking management I would have. Thank you!!!

  • @vpxc
    @vpxc 5 ปีที่แล้ว +93

    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
      @cc-hc1dr 4 ปีที่แล้ว

      can you give a link to a working example?

    • @vpxc
      @vpxc 4 ปีที่แล้ว +2

      @@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

    • @Neko-kun-dp1hq
      @Neko-kun-dp1hq 3 ปีที่แล้ว +1

      @@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.

    • @GeorgeSukFuk
      @GeorgeSukFuk 3 ปีที่แล้ว +3

      @@Neko-kun-dp1hq you should do some digging yourself which is clearly what pxc has done

    • @viktorovksy
      @viktorovksy 3 ปีที่แล้ว

      @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 ~`

  • @tackvector
    @tackvector 7 หลายเดือนก่อน +1

    I'm still coming back to this video to remember how to do this on new machines. The information presented here is invaluable. Thank you so much!

  • @evanstenger8590
    @evanstenger8590 7 หลายเดือนก่อน

    Thanks for putting together this video! I read that article, and then searched on TH-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!

  • @engageintellect
    @engageintellect 4 ปีที่แล้ว +8

    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.

  • @bobgrimes8618
    @bobgrimes8618 5 ปีที่แล้ว +2

    I am always learning something new every time I watch your show! Also, congratulations on your Saints winning on Sunday!

  • @ItsRyanStudios
    @ItsRyanStudios ปีที่แล้ว +4

    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.

  • @meowtabby5369
    @meowtabby5369 3 ปีที่แล้ว

    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!

  • @DDBAA24
    @DDBAA24 4 ปีที่แล้ว +12

    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.

  • @matthewstott3493
    @matthewstott3493 4 ปีที่แล้ว +18

    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.

    • @wemusthavechannelstocommen619
      @wemusthavechannelstocommen619 5 หลายเดือนก่อน

      what's the difference?

    • @matthewstott3493
      @matthewstott3493 5 หลายเดือนก่อน

      3 years later… Use GNU Stow to manage dotfiles. It does most of it for you.

    • @brainstormsurge154
      @brainstormsurge154 4 หลายเดือนก่อน

      Or you could alias editing and sourcing such as ebash to edit and sbash to source. Very convenient.

  • @gcasanas1
    @gcasanas1 2 ปีที่แล้ว +1

    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.

  • @mitchelvalentino1569
    @mitchelvalentino1569 5 ปีที่แล้ว +27

    Nice. Well-edited and informed Linux content that’s useful for both new and experienced Linux users. Surprisingly rare on TH-cam. Thank you!!

    • @DistroTube
      @DistroTube  5 ปีที่แล้ว +3

      Thanks, Mitchel.

  • @distroverse
    @distroverse 5 ปีที่แล้ว +6

    Yeah this method is really awesome, I use it for some time now. Can't live without it.

    • @DistroTube
      @DistroTube  5 ปีที่แล้ว

      Yea, can't believe I hadn't heard of this before now.

  • @RockTheCage55
    @RockTheCage55 7 หลายเดือนก่อน +1

    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

  • @fuseteam
    @fuseteam 4 ปีที่แล้ว +18

    but how would you clone in it in a fresh system?

    • @BillGarrett
      @BillGarrett 4 หลายเดือนก่อน +1

      git clone --bare repository-location local-dotfiles-location

  • @Gglsucksbigballz
    @Gglsucksbigballz 3 ปีที่แล้ว +7

    Great video. Would have liked to have seen you sync a few Dev machines off the bare repo - especially with different OS (folder locations)

  • @miss-astronomikal-mcmxcvii
    @miss-astronomikal-mcmxcvii ปีที่แล้ว +1

    Wow, this tutorial is very self-explanatory and very informational. Thank you sooo much! :)

  • @johannesmariomeissner7262
    @johannesmariomeissner7262 2 ปีที่แล้ว

    Excellent explanation, and a big thanks for referencing back to the Atlassian article. Love your content!

  • @dimaj1
    @dimaj1 5 ปีที่แล้ว

    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)

  • @UNNAM3D82
    @UNNAM3D82 4 ปีที่แล้ว +3

    Really cool of you to credit the author of the article you got the idea from, respect!

  • @Void-in2pz
    @Void-in2pz 3 ปีที่แล้ว +1

    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 ?

  • @QazCetelic
    @QazCetelic ปีที่แล้ว

    This is the most convenient method I've seen so far. Great video!

  • @dustinmorse8497
    @dustinmorse8497 5 ปีที่แล้ว +1

    Thanks DT! just set one of these up in my shiny new GitLab account!!!

  • @FredMny
    @FredMny ปีที่แล้ว

    hey DT
    I love your videos and am using this method since you posted about it.
    Is there a way to use the same bare repository, but use and update just specific files in different systems?
    My use case: I use Arch Linux on my personal computer, but have a Macbook for work. So, I don't need all my dotfiles from my Arch config, but just some like `.vimrc`, `.zshrc` etc.

  • @Drazil100
    @Drazil100 4 ปีที่แล้ว +1

    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).

  • @hzaphry
    @hzaphry 2 ปีที่แล้ว

    Just had my bare dotfiles repo. DT you're awesome. Thanks man

  • @SpittedDusk
    @SpittedDusk 5 ปีที่แล้ว

    Thank you, I will start using this method myself.

  • @king_and_country
    @king_and_country 5 ปีที่แล้ว

    NICE! This is so, so much easier. Thank you!

  • @tomaskrulis5796
    @tomaskrulis5796 3 ปีที่แล้ว

    Hello DT,
    I am having trouble using this approach with pugin directories of vim and .emacs.d directories from Doom Emacs, which are considered github repositories themselves. As a newbie, how can I solve that, since you are having those files in your repository?
    Thank you for any help with this.
    Regards, Thomas

  • @SantiYounger
    @SantiYounger 3 ปีที่แล้ว

    This video is excellent, by far this is my favorite method to manage dotfiles

  • @JS-kr7zy
    @JS-kr7zy 5 ปีที่แล้ว

    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.

  • @indigowyrm
    @indigowyrm 3 ปีที่แล้ว

    Maybe I'm doing something wrong but when I do config add . to add everything in my .config folder its trying to add all of my home folder with i.e -warning: adding embedded git repository: .cache/yay/f3
    Is there a way to add everything in the dotfiles at once? as there may be more changes from updates etc?

  • @bobkoss280
    @bobkoss280 3 ปีที่แล้ว

    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.

  • @jabuxas
    @jabuxas 2 ปีที่แล้ว

    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.

  • @VictorMartinez-vi7jx
    @VictorMartinez-vi7jx 2 ปีที่แล้ว

    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

  • @cc-hc1dr
    @cc-hc1dr 4 ปีที่แล้ว

    what about if I use the native vim package manager and manage those with submodules? - in ~/.vim/pack. can i make this part of my bare repo?

  • @matthill11
    @matthill11 3 ปีที่แล้ว

    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?

  • @pcfreak1992
    @pcfreak1992 5 ปีที่แล้ว +2

    TH-cam kept recommending me your videos and I enjoyed them a lot so far, so I just subscribed ;-)

  • @sylvershadow1247
    @sylvershadow1247 5 ปีที่แล้ว

    Pretty handy. Saved it in a playlist for future reference.

  • @devKazuto
    @devKazuto ปีที่แล้ว

    I like this approach, but how would you handle scripts that install a set of applications? In a separate directory called e.g. `.setup`?

  • @notchicken
    @notchicken 9 หลายเดือนก่อน

    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?

  • @you_what319
    @you_what319 5 ปีที่แล้ว +4

    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"

  • @doctorpine
    @doctorpine 2 ปีที่แล้ว

    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

  • @norcal6181
    @norcal6181 5 ปีที่แล้ว +2

    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.

  • @dmmeteo
    @dmmeteo 4 ปีที่แล้ว

    It's really cool solution! Thank you man! I know want I going to do tomorrow morning;)

  • @allegoricalstatue
    @allegoricalstatue 4 ปีที่แล้ว +4

    Damn, this is actually really cool

  • @michalski9141
    @michalski9141 2 ปีที่แล้ว

    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

  • @ankushmenat
    @ankushmenat 4 ปีที่แล้ว +1

    Thank you very much. Amazing video!

  • @WizardPlatypus
    @WizardPlatypus 3 ปีที่แล้ว

    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?

  • @bGrickD
    @bGrickD 3 ปีที่แล้ว +1

    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

    • @grapesalt
      @grapesalt 3 ปีที่แล้ว

      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)

  • @Jonathan-dm3pt
    @Jonathan-dm3pt 5 ปีที่แล้ว

    Very useful, thanks DT.

  • @VanStabHolme
    @VanStabHolme 2 ปีที่แล้ว

    Very useful and convinient. Thank you.

  • @omenquentama6453
    @omenquentama6453 3 ปีที่แล้ว

    if I generate .gitignore file with everything else selected than my dotfiles, am I able to do " add ."?

  • @rwprime1
    @rwprime1 3 ปีที่แล้ว

    DT help please with the syntax needed. Up on the gitlab server I would like a Dotfiles 'Project' (easy), then inside that a folder called .config and inside that a folder called openbox and inside that three files called autostart menu.xml rc.xml and I'm thinking I should be able to do this with one 'add', one 'commit' and one 'push' (I hope). What would it look like please (anyone). I have yet to find any info on how to create what look like nested directories up on gitlab. Every video I have watched only shows how to publish a single file and not directories with files. Can you just have config add .config/openbox/*.* ? How do I get my wallpaper in a different project called Wallpaper? Does the alias 'config' have to be changed? I would just like to know the basics of how you did what you have up on your gitlab.

  • @Tappo244
    @Tappo244 ปีที่แล้ว

    after having traced everything on your repository, if you change pc then you have to place each file by hand in the right place?

  • @ehsanamini8501
    @ehsanamini8501 3 หลายเดือนก่อน

    Great explanation as always. If you got around to recording a video about etckeeper, that would be also much appreciated.

  • @arykleinerman6516
    @arykleinerman6516 4 ปีที่แล้ว +6

    What do you do with the README.md file? Do you have to keep the README.md file in your home?

    • @allegoricalstatue
      @allegoricalstatue 4 ปีที่แล้ว

      Hah I have the exact same question. currently I just have a README.md in ~/ :/

    • @LordZultair
      @LordZultair 4 ปีที่แล้ว +2

      @@allegoricalstatue You can hide the README.md in a .github directory on ~/ (help.github.com/en/github/creating-cloning-and-archiving-repositories/about-readmes)

    • @aryklein
      @aryklein 4 ปีที่แล้ว

      @@LordZultair I didn't know that. Thanks

  • @elocinnet
    @elocinnet 3 ปีที่แล้ว

    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)."

  • @saltrocklamp199
    @saltrocklamp199 3 ปีที่แล้ว +2

    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.

  • @shrikamath
    @shrikamath ปีที่แล้ว

    How do I move my dotfiles to anothe machine and restore files ?

  • @frankeke8541
    @frankeke8541 4 ปีที่แล้ว

    I reinstalled my arch installation, cloned my dotfiles repo, set everything up. Couple days later I edited .vimrc. How do i add it to the repo?

    • @red13emerald
      @red13emerald 4 ปีที่แล้ว

      Frankeke with the alias. if you followed the exact steps in the video, it’s “config add .vimrc”

  • @Ethorbit
    @Ethorbit 2 ปีที่แล้ว

    This is super helpful and useful, thanks!

  • @twiksify
    @twiksify ปีที่แล้ว

    This is brilliant! 🎉

  • @pedro_alonso
    @pedro_alonso ปีที่แล้ว

    This has blown my mind, and was posted 4 years ago. Bruhh, how I don´t have seem that before

  • @sasakanjuh7660
    @sasakanjuh7660 5 ปีที่แล้ว +2

    Great, really interesting alternative! Btw, you can clean terminal with Ctrl+l, it's a bit faster :)

  • @reza.kargar
    @reza.kargar 3 หลายเดือนก่อน

    What a cool use case you 👌🏻, wonderful 😀 🙏🏻

  • @koszal_
    @koszal_ 4 ปีที่แล้ว +1

    Thanks!!! Great solution for me.

  • @Varma414
    @Varma414 5 ปีที่แล้ว +1

    I am new to this channel. What distro you are using and terminal you are using to look fancy ?
    ThankX

    • @DistroTube
      @DistroTube  5 ปีที่แล้ว +1

      I was using Manjaro. This was the i3 window manager at the time (I used i3 for three weeks recently). The terminal might have been xterm in this video. The terminal I used for most of my earlier videos was urxvt. The terminal I use currently is st. All fine choices.

    • @Varma414
      @Varma414 5 ปีที่แล้ว

      DistroTube Thanks for your response. I am using Manjaro too. I will i3.

  • @viniciusdufloth6015
    @viniciusdufloth6015 5 ปีที่แล้ว +4

    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
      @bitnatures 5 ปีที่แล้ว +1

      what would you need to version outside of HOME? most unix programs should respect a user config. Just curious.

    • @thierrybo6304
      @thierrybo6304 5 ปีที่แล้ว

      @@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)

  • @anantgupta7916
    @anantgupta7916 3 ปีที่แล้ว

    This method is super legendary.
    Thanks DT otherwise I will have a gitignore file with tones of thing in that

  • @RockingWomble
    @RockingWomble ปีที่แล้ว

    How do you setup a bare repo with gitlab?

  • @ShadwTrooper
    @ShadwTrooper 3 ปีที่แล้ว +2

    Jaw on the floor. /me Going to redo my dotfiles repo... Thanks, DT!

  • @atps
    @atps 4 ปีที่แล้ว

    That could be very useful. Thanks for the video.

  • @VulcanOnWheels
    @VulcanOnWheels 2 ปีที่แล้ว

    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.

  • @Berlm
    @Berlm 2 ปีที่แล้ว

    I gotta ask- does the laptop in the background exist only for the sole purpose of running cmatrix?

  • @abucketofelves
    @abucketofelves 5 ปีที่แล้ว +28

    It's just the, bare repository, the simple bare repository, forget about your worries and your strife

  • @VasanthDeveloper
    @VasanthDeveloper 5 ปีที่แล้ว

    Greatly explained!

  • @diszydreams
    @diszydreams 7 หลายเดือนก่อน

    Thanks! Still valid! works for me!

  • @unabonger777
    @unabonger777 5 ปีที่แล้ว

    Is the video flipped or do you have your headphones on backwards?

  • @SheldonHull
    @SheldonHull ปีที่แล้ว

    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

  • @dasfotobernd
    @dasfotobernd 5 ปีที่แล้ว

    Ok, this is probably a stupid question, but what's wrong with doing the init in your home dir and just adding files you care about?

  • @surferbum618
    @surferbum618 5 หลายเดือนก่อน

    Hey DT, just wanted to check in and see if this is still the way you're managing your dot files?

  • @johnsonmcbig9157
    @johnsonmcbig9157 4 ปีที่แล้ว +2

    What if you make the whole root folder a repository?

    • @jeetadityachatterjee6995
      @jeetadityachatterjee6995 4 ปีที่แล้ว +1

      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.

  • @kendawg_mcawesome
    @kendawg_mcawesome 5 ปีที่แล้ว

    Very nice, great tip.

  • @ramzeslo2
    @ramzeslo2 4 ปีที่แล้ว +1

    why not just rsync all the dotfiles to a safe place and make backup and restore on a new system?

  • @praetorxyn
    @praetorxyn 4 ปีที่แล้ว

    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.

  • @k2a3r4l5o6
    @k2a3r4l5o6 5 ปีที่แล้ว +1

    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.

    • @maroskukan8387
      @maroskukan8387 ปีที่แล้ว +1

      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

  • @konscodes
    @konscodes 2 ปีที่แล้ว +3

    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

    • @exnihilonihilfit6316
      @exnihilonihilfit6316 11 หลายเดือนก่อน

      You did good, learning basic git(hub) use normally takes days to learn. 😀

  • @piotrtalarczyk8987
    @piotrtalarczyk8987 5 ปีที่แล้ว

    I think that if I sync .dotfiles between few not equal machines, then symlinks' method is bettere. I can have in repo for example .bashrc-pc and .bashrc-rpi and then symlink the right one.

    • @xome4ok
      @xome4ok 5 ปีที่แล้ว +2

      You could just have different branches for each machine.

    • @abaumarabahilal1189
      @abaumarabahilal1189 5 ปีที่แล้ว

      @@xome4ok But I think branches other than 'master' are not meant to be kept.

  • @kriseberwein7357
    @kriseberwein7357 5 ปีที่แล้ว +8

    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"

  • @GR3YS0RG4N1CS
    @GR3YS0RG4N1CS 11 หลายเดือนก่อน

    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"

  • @modaryaghi
    @modaryaghi 3 ปีที่แล้ว +1

    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!

    • @SupaShang
      @SupaShang 3 ปีที่แล้ว +2

      I had that too, I fixed it by doing this: config push --set-upstream git@gitlab.com:myusername/dotfiles.git master

  • @espehon
    @espehon ปีที่แล้ว

    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
    }

  • @max_ishere
    @max_ishere 3 ปีที่แล้ว

    I may have just spent a day writing a script to do all the sync... The good thing is I learned bash.

  • @TheKhanj
    @TheKhanj 2 ปีที่แล้ว

    Have you ever tried to use GNU stow instead?

  • @picosdrivethru
    @picosdrivethru 4 ปีที่แล้ว

    can a bare repo be on another drive?!!! can it access files in a folder strcuture adjacent to HOME or above it?! omg

  • @apoorv9492
    @apoorv9492 4 ปีที่แล้ว

    damn, that is a sexy desktop. which wm is this?

  • @philippkrause7650
    @philippkrause7650 3 ปีที่แล้ว

    Awesome solution, thx

  • @pengpleb
    @pengpleb 5 ปีที่แล้ว +23

    I just gitignore every file with "*" and then use git add -f with each file I want to track.

    • @BlackM3sh
      @BlackM3sh 5 ปีที่แล้ว +19

      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.

    • @pengpleb
      @pengpleb 5 ปีที่แล้ว +4

      @@BlackM3sh I never knew that was a possibility, thanks I'll try it out.

    • @fuseteam
      @fuseteam 4 ปีที่แล้ว

      @@BlackM3sh ohw both /.config/ _and_ /.config/* is neccesary imma try this

    • @feschber
      @feschber 4 ปีที่แล้ว

      that would have been my first idea