What is a bare Git repo and why you need them

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

Комментарии • 128

  • @lukasberk9303
    @lukasberk9303 4 года назад +42

    You are so good at teaching. You ask the same questions I have during the video at the same time. This makes you more a teacher and a student who is sitting beside you wondering the same thing. Really nice.

  • @YisraelDovL
    @YisraelDovL 5 лет назад +19

    Yep this is how we did things before github was a thing, and even after if you wanted private repos. People thing github is synonymous with git, important to know that they are not.

  • @bigmandan
    @bigmandan 5 лет назад +13

    You can also use a bare repo and the hook scripts ( post-receive for example ) as a deployment mechanism too.

    • @EngineerMan
      @EngineerMan  5 лет назад +8

      Huh, I never actually thought to use them for that purpose. Nice one.

  • @xenialxerous2441
    @xenialxerous2441 5 лет назад +21

    Hey there! I'm genuinely glad that I came across your channel & got to be a part of an amazing wealth/treasure of knowledge that is enlightening and informative. Thank you so much, & I'll join you over your discord server.. thanks again!

  • @michaelm3404
    @michaelm3404 5 лет назад +13

    Wow. Best explanation, rich content. So many other channels spend so much time on fluff and groundwork, you just go straight to the point not worrying if you talk to fast (we are on RUclips after all, people can rewind!) - great work.

    • @emjizone
      @emjizone Год назад +1

      Finally I don't need to factor the tempo of the video by 1.5 or 2 to follow it without falling asleep or getting distracted. 😄

  • @emjizone
    @emjizone Год назад +3

    Clear, informative, straight to the point, no drama, and useful.
    Perfect for me. Best communication mode ever.
    Thanks !

  • @user-yb1cm4fd6h
    @user-yb1cm4fd6h 5 лет назад +7

    Thanks a bunch. I didn't know about this feature and have started using it right after watching your video. I'm the sole developer on all my personal projects (as an humble hobbyist) and I actually have no need for remote services.

    • @harleyspeedthrust4013
      @harleyspeedthrust4013 4 года назад +2

      Be careful, if you host all your repos on a local disk you risk losing them if something happens. A huge benefit of remote hosting (like that provided by github) is that you don't have to worry about losing your work for good. In fact, github recently backed up a ton of repositories to a secure arctic facility (arctic code vault) that stores several copies of data in different formats

    • @user-yb1cm4fd6h
      @user-yb1cm4fd6h 4 года назад

      @@harleyspeedthrust4013 You're absolutely right but I have that covered with daily backups on my NAS, an external HDD and a USB thumbdrive, plus weekly backups on a remote backup service. I have never considered github as a backup solution, just a necessity to host my workflow until I discovered I could just have it locally with this video. You're right though, DO BACKUP FOLKS ;-)

  • @gregorywpower
    @gregorywpower Год назад

    Years later and this is one of the best videos on this topic.

  • @paulm3702
    @paulm3702 5 лет назад +28

    These videos git better every time!

    • @FirstLast-hm8oz
      @FirstLast-hm8oz 4 года назад

      Before I said "Igitigit", but now I say "Super".

  • @karolgutkowski4678
    @karolgutkowski4678 Год назад +1

    Great explanation, i stumbled upon bare repo when working with git worktrees and didn't understand what that bare repo i was having to pull was. Great and quick explanation, i even gasped when you cloned from a repo that was just on your local machine. All the abstraction that modern platforms provide kind of obstruct that this is "just" a fancy folder structure :)

  • @yeetyeet7070
    @yeetyeet7070 Год назад +1

    didn't even know I needed this, but I needed this so urgently

  • @m4rt_
    @m4rt_ Год назад

    and if you put that bare repo on a server that you have ssh access on, you now host your own git repos
    (also you can actually work on code in a bare repo by doing: git worktree add and cd )

  • @kkyes
    @kkyes 3 года назад

    I scratched my head for few hours and thank god I found you...so clear and precise explanation..

  • @Zhouri
    @Zhouri 7 месяцев назад

    Sometimes I really don't know whether im gonna use this knowledge or not, I just enjoy knowing it.

  • @Omar.Alamoudi
    @Omar.Alamoudi 3 года назад +1

    This is a great and concise video. If you are looking into converting a regular repot to a bare repo see 4:20

  • @cindrmon
    @cindrmon 2 года назад

    i discovered doing this by accident! now i'm able to have a private bare repository with all my important files that i wanna keep track on

  • @ItzeMiiSimi
    @ItzeMiiSimi 5 лет назад +4

    Clear, concise and helpful, thanks :)

  • @GabrielIchiro
    @GabrielIchiro 5 лет назад +2

    well that was intersting
    hopefully someday I'll need it, thanks Engineer Man!

  • @stefanciltea3186
    @stefanciltea3186 4 года назад +1

    Very on point and well made video, congrats!

  • @MobiusCoin
    @MobiusCoin 5 лет назад

    2:24 Wrong! THis is sooooo useful! I absolutely need this! Thank you so much!

    • @heinzerbrew
      @heinzerbrew 5 лет назад

      Ummm.... Are you short on storage space or something? The bare repo doesn't do anything that the full one doesn't.

    • @EngineerMan
      @EngineerMan  5 лет назад +1

      For one, other people can't push to a branch in another repo that has the same name and is currently checked out.

    • @heinzerbrew
      @heinzerbrew 5 лет назад

      @@EngineerMan I see. I must have missed that in the video.

  • @theRealtensigh
    @theRealtensigh 5 лет назад

    Very cool. It seems I have more to learn about Git every day.

  • @tobeypeters
    @tobeypeters 4 года назад

    I use one to make it simple to push my, mostly, dot files to GitHub. I can add a file from anywhere, commit it, and push it up to GitHub. So, if you look for tobeypeters on there, you'll see a dotfiles repo with my .bashrc and such.

  • @alirezaparsay8518
    @alirezaparsay8518 Год назад

    Great, exactly what I needed to know.

  • @GuilhermeTeixeira
    @GuilhermeTeixeira Год назад

    Amazing explanation. Thank you!

  • @reza.kargar
    @reza.kargar 8 месяцев назад

    Wonderful explanation 👌🏻, thank you 🙏🏻

  • @m4l490n
    @m4l490n 5 лет назад +2

    Cool! Now please make video about how to host our own git repos in our own linux server so we can access them across the internet.

    • @sabrinnnaaaaaaa
      @sabrinnnaaaaaaa 5 лет назад

      I think an ftp server would work, you could put it's ip in when you're cloning

    • @thanatos454
      @thanatos454 5 лет назад

      Have you looked into using GitLab?
      www.techrepublic.com/article/how-to-set-up-a-gitlab-server-and-host-your-own-git-repositories/

    • @unabonger777
      @unabonger777 5 лет назад

      @@sabrinnnaaaaaaa You can use ssh and set up a shared directory on the server for the repos to live in.

  • @dexterman6361
    @dexterman6361 5 лет назад +1

    Who dem downvotes?!
    This is GOLD! Man an amazing channel!

  • @abhishektyagi4428
    @abhishektyagi4428 5 лет назад +11

    Sir Could you please make a video explaining the resources you use to learn or enhance your programming skills

    • @DavidWoodMusic
      @DavidWoodMusic 3 года назад +1

      Keep in mind he's been programming for 20 years.
      The best answer to this is to actually build things.

  • @blank001
    @blank001 3 года назад

    Bare repo for dotfiles
    This is such a easy way to manage dotfiles across multiple systems and track them easier

  • @shashankshekhar624
    @shashankshekhar624 5 лет назад +2

    Man, you are amazing

  • @joseville
    @joseville 4 месяца назад

    Great video! Do you use bare repo w/ worktrees? (git worktree add)

  • @mmmmmwha
    @mmmmmwha 3 месяца назад

    So clear. Thanks

  • @moazelsawaf2000
    @moazelsawaf2000 Год назад

    Great video and very interesting concept ❤

    • @terry-
      @terry- Год назад +1

      Great! Would be very interesting to see this in convination with git worktree

  • @jada90
    @jada90 5 лет назад +3

    This is so obvious I feel silly for not thinking about this earlier. Is this how people used git before github and gitlab?

    • @EngineerMan
      @EngineerMan  5 лет назад +3

      Yes, particularly useful for internal networks and ones with shared drives.

  • @bulletinmybeard
    @bulletinmybeard 5 лет назад

    Thank you, that was quite interesting and something I didn’t know about. I often clone gut repos to checkout the source code and will next time clone it as bare repos as I don’t have any interest to push anything I update. Thanks 🙏

    • @heinzerbrew
      @heinzerbrew 5 лет назад +1

      You missed the point of the video. You won't get any source code with a bare repository that is the whole point of it.

    • @bulletinmybeard
      @bulletinmybeard 5 лет назад

      heinzerbrew wrong

    • @heinzerbrew
      @heinzerbrew 5 лет назад

      @@bulletinmybeard How so?

  • @danielmwale9959
    @danielmwale9959 5 лет назад +3

    If I pull in a bare repo and that becomes the core from which I get my workspaces, can I then later push to original repo?

    • @TerrisLeonis
      @TerrisLeonis 5 лет назад +3

      Yes, if you have the original repo as the bare repo's upstream remote (e.g. if you cloned the bare repo from GitHub), then you can just "git push" from the bare repo.
      Any commits you've pushed to the bare repo will then get pushed to the upstream.

  • @TheHermitHacker
    @TheHermitHacker 5 лет назад +1

    Okay, this is pretty awesome.

  • @albertoazinar1209
    @albertoazinar1209 3 года назад

    one more time u saved my a**, thanks alot Engineer Man!

  • @internetperson2
    @internetperson2 5 лет назад +7

    Dark souls players don’t want you to know this is where you can actually git gud

  • @Matt23488
    @Matt23488 5 лет назад

    Wow, that's pretty nifty.

  • @4mb127
    @4mb127 Год назад

    Great stuff

  • @Speak4Yourself2
    @Speak4Yourself2 6 месяцев назад

    Thanks a lot!

  • @jpgarcia90
    @jpgarcia90 2 года назад

    cool video, straight to the point, thanks! How would you go about hosting a bare repo on a cloud service like AWS?

  • @bibhashroyhello
    @bibhashroyhello 4 года назад

    Good video E-Man :)

  • @rbid
    @rbid 5 лет назад

    Many thanks

  • @MarsGamer7
    @MarsGamer7 5 лет назад

    Great video!

  • @deekshantmalvi4612
    @deekshantmalvi4612 4 года назад

    thanks man

  • @tjoh4605
    @tjoh4605 5 лет назад

    this is gold

  • @n3r0z3r0
    @n3r0z3r0 5 лет назад

    Thanks!

  • @aydencook03
    @aydencook03 5 лет назад +1

    I don't know what most of this means, but I really want to learn... Where do I start?
    Where did you start? And what resources have you used?

    • @esbenboye
      @esbenboye 5 лет назад

      There's lots and lots of online resources and thus, lots of places to start. It's hard to point to one specific resource, but searching for "getting started with git", "git for beginners" or "git tutorial" will ger you something to work with :)

  • @jaopredoramires
    @jaopredoramires 2 года назад

    hey man, what distro do you use? i really wanna know what terminal & what colorscheme you're using

  • @paulmorrey733
    @paulmorrey733 5 лет назад

    Thanks

  • @ELIKOOKOO
    @ELIKOOKOO 5 лет назад

    Thanks for the video!,
    may i ask what OS r u using in that video? its not Ubuntu right?

    • @zinsy23
      @zinsy23 5 лет назад +1

      I think it's Xubuntu if I'm not mistaken. He mentioned this in a few videos, including "10 things you can do with Linux that you can't do with Windows
      ".

  • @faizanvanekar7882
    @faizanvanekar7882 11 месяцев назад

    How can we add this GIT repo to our Jenkins job to build ? Is that even possible? Kindly let me know. Thank you in advance !

  • @6s6
    @6s6 5 лет назад +1

    At 4:49, the files in felix_bare/ are listed with ls, and it shows all of the files within .git
    Shouldn't it just be listing .git, not the files actually in .git?
    At 4:35 you only moved .git into felix_bare/, right?

  • @aravindreddy6802
    @aravindreddy6802 5 лет назад +1

    Git rebase vs cherry pick plzz

  • @pixelPlex
    @pixelPlex 5 лет назад

    Would a bare Git repo be the way to go when making a backup of a existing Git repo?

    • @heinzerbrew
      @heinzerbrew 5 лет назад +1

      It depends on what you want. He explains the difference in the video. A bare git repo won't have your workspace. So if you want your complete repo backed up then you need to back up the whole thing. If you just want to be able to restore your project then the bare git will be the bare minimum to backup. Git it?

  • @StphRolland
    @StphRolland 3 года назад +1

    It seems clear how to clone the repo from a shared drive where would be the bare repo. But I have not grasped how to push, and pull. How do you define the remote, if this remote is not using neither ssh nor http ? Maybe your video goes a bit too fast on this.

    • @StphRolland
      @StphRolland 3 года назад +1

      Self answering: no explanation is needed, it is super extra simple => the fact of cloning the repo from the file system creates a git repo that does not need either ssh or https. When doing git push origin master, it will simpy copy to the filesystem address. Simple and direct like that. I could not believe it.

  • @JethroYSCao
    @JethroYSCao 3 года назад

    Does git fetch work in a bare git repo?

  • @akaziehl
    @akaziehl 5 лет назад

    Question. If you commit something to the repository, does the bare repo update too? Since I've understood when you commit you do the commit to the actual repository, not the bare one.

    • @sabrinnnaaaaaaa
      @sabrinnnaaaaaaa 5 лет назад

      If I understand correctly, the bare repo acts like a fork, so it wouldn't update with the original repo

    • @user-yb1cm4fd6h
      @user-yb1cm4fd6h 5 лет назад

      You have to push to the bare repo, as you would with a remote repo (github, etc).

  • @wakaitsuwamono
    @wakaitsuwamono 5 лет назад

    Cool! I did not know that.
    Might not be a good question, since it's not for Git. Does the terminology and mechanics also apply to Mercurial. Cause it also has something like a .hg directory?

    • @bdafeesh
      @bdafeesh 5 лет назад +1

      Mercurial/svn share /some/ of these concepts, but will be completely different commands (at the very least). But if you can help it, don't ever use mercurial/svn. The technology is so outdated and strictly worse than git in almost every way. The only benefit something like svn has is that it comes pre-packaged with a GUI and a little easier to get started with. Any serious engineer uses git and is the industry standard.

    • @wakaitsuwamono
      @wakaitsuwamono 5 лет назад

      @@bdafeesh Thanks! Good advice.

  • @tylerlwsmith
    @tylerlwsmith 7 месяцев назад

    Wild

  • @mayur9876
    @mayur9876 5 лет назад

    That's so cool

  • @bhc1892
    @bhc1892 5 лет назад +1

    Just to share a cool way bare repos have helped me in the past - I had two non-networked computers that were being used to dev on a codebase. To keep things in sync, I created a bare repo on a removable hard drive, and cloned to both computers from the removable drive. Then once a day we'd plug the drive into each computer and do git pull..., git push.

  • @eslamalshiki2650
    @eslamalshiki2650 5 лет назад

    Alsalam Alikom,
    I want to devolop a system that is like a githup, so, what shuld i do, bare repostry or non-bare, becouse the non-bare makes clients cannot push to origin if the origin is checkedout to master and the client too.

    • @EngineerMan
      @EngineerMan  5 лет назад

      I think you answered your own question. GitHub likely uses bare repos as the base.

  • @usingvancedplzdontban1128
    @usingvancedplzdontban1128 4 года назад

    Which linux distro is he using?

  • @rizwanfirdous
    @rizwanfirdous 5 лет назад

    How to push a bare repo to GitHub and make as a GitHub project??

  • @YisraelDovL
    @YisraelDovL 5 лет назад

    To convert to a bare repo, you could have just cloned the non-bare repo with the --bare flag. Also worth pointing out that you can do all of this with non-bare repos as well.

    • @heinzerbrew
      @heinzerbrew 5 лет назад

      Mmm... Yes I was wondering why the big fuss? I see so many positive comments here, but from what I can tell the only advantage with the bare git is that it doesn't take up as much space since it is only the git folder.
      There are people gushing with praise for this video and how useful this tip is, but I don't see what is so great about it. What am I missing?

    • @unabonger777
      @unabonger777 5 лет назад

      @@heinzerbrew You use ssh and set up a shared folder on a server for your remotes. So you don't need github, etc.

    • @heinzerbrew
      @heinzerbrew 5 лет назад

      @@unabonger777 Correct you don't need git hub, you never did before this video. So why are people losing their minds about how awesome this video is? I am not trashing the video. I just don't get some people's reactions.

  • @shirounurimba6898
    @shirounurimba6898 5 лет назад

    Could anyone tell me what's a workstation?

    • @benjamincvcvcv7
      @benjamincvcvcv7 5 лет назад

      A computer you do work on. Eg a desktop or laptop

    • @shirounurimba6898
      @shirounurimba6898 5 лет назад

      @@benjamincvcvcv7 Ah, gotcha. Thanks for the info!

  • @AnCacaMilis
    @AnCacaMilis 5 лет назад +2

    I've watched this video 3 times through now and as a regular (newbie) user of git, I can't grasp why this is useful. 😔 Went right over my head

    • @user-yb1cm4fd6h
      @user-yb1cm4fd6h 5 лет назад +1

      So you can use a local folder instead of a remote service like github to pull/push from.

    • @AnCacaMilis
      @AnCacaMilis 5 лет назад

      @@user-yb1cm4fd6h thanks for response. Think I need to research a bit more 👍

    • @heinzerbrew
      @heinzerbrew 5 лет назад +1

      @@user-yb1cm4fd6h ummm you can do that with a regular repository.

  • @fadop3156
    @fadop3156 5 лет назад

    What distro is he using?

  • @antonsurviyanto5896
    @antonsurviyanto5896 5 лет назад +1

    how to update installer packages from git clone?

  • @kamesenLBC
    @kamesenLBC 5 лет назад

    BEAR REPO

    • @EngineerMan
      @EngineerMan  5 лет назад +1

      Did it all with my bear hands.

  • @Little-bird-told-me
    @Little-bird-told-me Год назад

    what i learned use git add -A instead of git add .

  • @matthewb3853
    @matthewb3853 2 года назад

    I wish this video ended at 2:28

  • @nodidog
    @nodidog 3 года назад

    🐻

  • @ClauSalvio
    @ClauSalvio Год назад

    Converting Non-bare repo to Bare repo: ruclips.net/video/8aZW9mYOxhc/видео.html
    @engineerman Thanks for this good explanation!

  • @tolulopemakinde4538
    @tolulopemakinde4538 Год назад

    Very very very explanatory video...
    It needs that exaggeration.

  • @Tux.Penguin
    @Tux.Penguin 5 лет назад

    Using a local offline repo like you outline in this video might have some advantages, but doesn’t it leave you more vulnerable to losing your project? If you’re going to protect your work by backing up regularly (which we all should) wouldn’t it just be simpler to skip this whole bare repo thing and use an online service like GitHub?

    • @bhc1892
      @bhc1892 5 лет назад

      There are situations where github isn't the right option. For me they happen a lot. The fact that git can be used in this way is why I fell in love with it to start with. I can start a small project, run "git init" in the folder, and suddenly I've got version control, branches, and the ability to let coworkers collaborate with me by doing "git clone ssh://user@myip:/path/to/the/repo". And if you spread the work across multiple computers, git is giving you a ghetto backup solution anyway, since both machines have the full repo.

  • @subkhanave
    @subkhanave 5 лет назад

    i know git bare repo is from oxidized (rancid alternative)

  • @diegonovas4974
    @diegonovas4974 5 лет назад +1

    Your subtitles are only in Russian. Can you put them in English?

    • @EngineerMan
      @EngineerMan  5 лет назад

      I have Russian subtitles?

    • @diegonovas4974
      @diegonovas4974 5 лет назад

      @@EngineerMan It is the option that appears.

    • @love.society
      @love.society 5 лет назад

      @@EngineerMan haha
      It generated automatically)
      RUclips is kidding

    • @love.society
      @love.society 5 лет назад

      @@EngineerMan but I can help you with Russian subtitles

  • @robertbrooks3849
    @robertbrooks3849 5 лет назад

    4th :-)

  • @kyleztoohype2056
    @kyleztoohype2056 5 лет назад

    First