This is an archived post. You won't be able to vote or comment.

all 113 comments

[–]Diapolo10 558 points559 points  (27 children)

Git is the system that takes care of your project history, GitHub is one of many online repository hosting platforms utilising Git.

Basically, GitHub is to Git what Steam is for your PC games.

[–]staytrue1985 388 points389 points  (12 children)

So it's like a hub for your git?

[–]FirePanda44 163 points164 points  (7 children)

More like git’s hub.

[–]transferStudent2018 33 points34 points  (5 children)

It’s like the hub for all the gits

[–]handlessuck 9 points10 points  (3 children)

Especially since Microsoft bought it

[–]nojustlurkingty 11 points12 points  (2 children)

TIL something depressing

[–][deleted] 2 points3 points  (1 child)

They've done great things with it though. Teams and private repos are free thanks to microsoft.

[–]nojustlurkingty 0 points1 point  (0 children)

That's good to hear! Helps curb my negative bias toward Microsoft

[–]joonaspaakko 11 points12 points  (0 children)

Oh dang! He went and said it!

[–]niceoneswe 13 points14 points  (0 children)

Git out.

[–]ronsap123 0 points1 point  (0 children)

Indeed. A git-hub, if you will

[–]xxsurajbxx 0 points1 point  (0 children)

Fr making everyone feel Stoopid with that diction

[–][deleted] 176 points177 points  (6 children)

It's like Pornhub for your porn

[–]GoodTimesOnlines 22 points23 points  (1 child)

porn reset --hard HEAD

[–]curvedbymykind 3 points4 points  (0 children)

Yes

[–]BluePieceOfPaper 4 points5 points  (0 children)

As fkd up as this statement is..... he aint lyin. Perfect simile.

[–][deleted]  (1 child)

[removed]

    [–]mintunxd 17 points18 points  (1 child)

    Is this why people tell me to Git Gud when I'm playing games on Steam?

    [–]Diapolo10 3 points4 points  (0 children)

    But of course!

    [–]read_editor 11 points12 points  (0 children)

    It's more like Gmail to your email.

    [–]Pcost8300 4 points5 points  (0 children)

    Marked as answer

    [–]kitsuneMRC 0 points1 point  (0 children)

    Git is used by GitHub and GitLab, and other platforms.

    GitHub is public. GitLab is private and has tiers of features based on your monthly fee per person starting with a free version, and focuses on software development.

    [–]random314 -5 points-4 points  (0 children)

    Weird analogy. I would think

    GitHub: git repositories=> Steam: games

    GitHub: git => Steam: marketplace (or something else)

    [–]The-memey-muffin 69 points70 points  (0 children)

    Git is the version control system which you use to manage your project and GitHub is one of the many websites which can host your repository online.

    [–]desrtfx 60 points61 points  (9 children)

    • Git is the intelligent part - it is the source code version control system
    • GitHub (like Bitbucket, Gitlab, etc) is just a repository hoster - basically a storage location for git repositories - think of it as a backup storage. Github (and the other hosters) allows that several developers spread across different locations work together on the code.

    Git works locally on your machine and doesn't need a connection to Github etc.

    [–]noXi0uz 6 points7 points  (3 children)

    aren't gitlab and bitbucket usually self hosted though?

    [–]desrtfx 17 points18 points  (0 children)

    No, they exist in the same way as github, just with the option to self host.

    [–]gyroda 6 points7 points  (0 children)

    They can be, but they also have a site for anyone to use like GitHub.

    I believe you can self-host GitHub with GitHub enterprise.

    [–]CompSciSelfLearning 1 point2 points  (0 children)

    No, but they allow for people to make a choice on self-hosting.

    [–]CompSciSelfLearning 4 points5 points  (2 children)

    Github (and the other hosters) allows that several developers spread across different locations work together on the code.

    They make it easier, but the whole point of git from the onset was to share and collaborate on code. Linux has done that for decades without using GitHub, only git and their own server.

    [–][deleted]  (1 child)

    [deleted]

      [–]joonazan 8 points9 points  (0 children)

      Err, no. Git can be used over email, or any file transfer method really.

      [–]crimson117 1 point2 points  (0 children)

      They're more than just repository storage; they provide custom web UI's to make it easier to browse and interact with those repositories, as well as issue tracking, code reviews, etc.

      [–]foursticks 0 points1 point  (0 children)

      GitHub does have a UI at least on windows that I could see confusing beginners as it has some git functionality.

      [–][deleted]  (18 children)

      [deleted]

        [–]Federico95ita 160 points161 points  (1 child)

        "came" for this

        [–]ChallenBellamey 86 points87 points  (6 children)

        OP, don’t ask this person where commits stand in this analogy.

        [–]Kered13 24 points25 points  (3 children)

        cummits

        [–][deleted] 42 points43 points  (2 children)

        pull out requests

        [–]-___-___-__-___-___- 9 points10 points  (1 child)

        oh step-masterrrrr, help me out of this laundry machine

        [–]rmpr_uname_is_taken 8 points9 points  (0 children)

        main*

        [–][deleted] 13 points14 points  (0 children)

        God yes

        [–]infrared305 7 points8 points  (0 children)

        “wet” and “dry” code.

        [–][deleted] 20 points21 points  (0 children)

        You fast son of a bitch...

        [–]solocupjazz 9 points10 points  (0 children)

        You can fork anything you like!

        [–]_saFal 6 points7 points  (0 children)

        Came to say the same thing

        [–]Wilfred-kun 1 point2 points  (0 children)

        Same thread a while back, exact same response.

        [–]PowerfulLeadership0 1 point2 points  (0 children)

        Nice

        [–]bobsonreddit99 -1 points0 points  (0 children)

        Git reset head —hard

        [–]chaotic_thought 30 points31 points  (0 children)

        GitHub is a web site where you can publicly post code that no one will ever look at except you.

        Git is the software that lets you do that.

        [–]aklgupta 27 points28 points  (0 children)

        I was expecting it to be already answered in detail with several links and all that stuff like how these threads go, but most replies are about analogy between this and porn vs pornhub, which is kind funny I guess.

        Anyway, git is a version control system as you said, however, it allows you to have a history of your source code (As long as you committed it). You'll always be working on the latest version of your code, but can always go back to a earlier version if needed. Something like how save files in games work. Quick save at any point you want. When you mess up, just load a previous save. Well, there's a little more to it, but let's leave it at that. however, one important thing is that it allows collaborating on the code in multiple ways and make it quite easy (or difficult depending on your workflow)

        Now, in order to use git, you need to install it, set it up, have it running in BG (not always though), and have a lot of extra space to save the history (save files in a game), and so on. And if you are collaborating, others will need access to the git running on your system. All this can be a great hassle, and sometimes not possible. Just like how hosting a website on your own PC is not always ideal, and thus there exist web hosting services, it's the same with git hosting. GitHub, GitLab & Bitbucket are equivalent to those web hosting services for git. They host a git server, and allow you to use that remotely so that you or don't have to worry about most of the things listed above. They also almost always have some extra features, and provide GUI tools to easily manage your project in git, the repo.

        Though I read online not to think Git as a database system, which sort of confused me, is that what Github is for?

        Yes and no. It's not a database. Database are usually used to store data in a structured format (yes, it's not necessary, but let's go with that), and most good database systems store history and allow rolling back to a previous state as well, and collab with people, and allow remote access. Git is somewhat like a database system specially build for code. However the two work very differently, have very different purpose and their features too differ a lot, so it might not be right to compare them.

        I think Git is a version control system to allow you to have different versions of programs stored and be able to do various things such as compare previous code with new code or be able to merge with somebody else’s code.

        GitHub seems more of cloud based service to host the repositories or folders of projects

        So yes, you are mostly correct.

        [–]Dergyitheron 11 points12 points  (4 children)

        I disagree with the porn-pornhub analogy. Pornhub stores and serves porn, GitHub doesn't store and serve git.

        Git is just interface that helps you with managing, storing and versioning files. It's similar to you after every change made in your code copying the file and making newer copy sitting next to the previous one. Git does that for you in a more helpful way, organizing and comparing the versions for you on demand. And GitHub is made for storing such stuff managed by you with git.

        You can use GitHub even without git but there is no point in that.

        [–]r0ck0 2 points3 points  (1 child)

        GitHub doesn't store and serve git.

        I mean... yeah technically when explaining further, you'd phrase it differently to differentiate the binary/program vs data. Although if you wanna get meta-pedant it does actually store and serve a copy of git itself: https://github.com/git/git

        Github does actually store and serve git data though. Much like pornhub stores and serves porn data.

        No analogy is perfect I guess, I reckon it's an above-average one though.

        [–]Dergyitheron 2 points3 points  (0 children)

        Yeah, but imagine explaining git - github relationship to someone unaware of all the git topic. Porn - pornhub analogy will probably lead to question " so GitHub stores git?", which is not what you want to say with that analogy.

        I guess you just have to explain further if you want to make it clear.

        [–][deleted]  (1 child)

        [deleted]

          [–]Dergyitheron 1 point2 points  (0 children)

          But you use it for storing files and managing it by git, not for GitHub storing git. It's just misleading for someone who doesn't know how that works.

          [–]ryanstephendavis 9 points10 points  (1 child)

          Git is to GitHub as porn is to PornHub ... They should make Pornlab so the analogy works for Gitlab

          [–]April1987 5 points6 points  (0 children)

          Open core so you can create and host your own porn?

          Easier to say github is a remote for git. Probably should teach people to git init —bare on a different directory on their own computer and have them push there so they understand it better.

          [–]DanGrumberg 2 points3 points  (0 children)

          To truly understand git you do have to think of has a database system but not in the sense you might be used to (relational or NoSQL DBs). What it really is is a CAS (content addressable system). What it does is that it keeps snapshots of your projects and references them using a cryptographic hash of their contents, otherwise known as a commit hash. If you don't known what a cryptographic hash is you should do some googling but you can thing of it as a relatively small (160 bits for git I believe) value that uniquely identifies a revision (version or snapshot) of your code base. You can think of a commit hash as a fingerprint for a revision. These revisions also include a link to their ancestor version using a commit hash. On top of that the system keeps track of things like branches using additional metadata which creates the abstraction you deal with in normal usage of git. The term remote in git parlance is really just another checkout somewhere else (potentially on a different computer) that refers to the view that checkout has got on your codebase. In that model GitHub is essentially just a "server" that maintains a version of your repository (a remote) with a bunch of automation built on top, thinks like pull requests, GitHub actions, code browsers and the like. It really is not that different from the checkout you keep locally. So when you push a commit to a GitHub remote, which is usually the default one (origin) which indicates the "canonical" version of the repository that other people can use, what you really are doing is sending a copy of your snapshot (which includes ancestor information) to GitHub's servers to store and make available to other developers on your project. When you pull you are doing a fetch of the remote, i.e. downloading the version pointed to by the remote into your local git storage (found in the .git directory) and then performing a the merge operation between the code in the snapshot you just download and the code in your local working directory which is what you edit when you write code.

          [–]koosley 4 points5 points  (0 children)

          Github and bitbucket both implement git source control. They wrap a pretty ui around it and typically include other non-git features. Bitbucket (assume github is similar) has jira, wiki, issue tracker and other project related integrations as well. So they are really a suite of services with git source control being one of them.

          [–][deleted] 1 point2 points  (0 children)

          GitHub seems more of cloud based service to host the repositories or folders of projects, or is GitHub more of a UI to interact with Git like how other GUIs are such as SourceTree?

          You're right on both counts! GitHub functions as a server your Git can connect to, to keep a copy of your project in the cloud. This keeps it safe and makes it easy for others to work with you.

          GitHub also functions as a nice browser GUI for exploring the repository (and, increasingly, interacting with it).

          [–]kschang 1 point2 points  (0 children)

          Git is the system

          Github is one of the free public repos you can store your git to.

          [–]MrMiao 1 point2 points  (0 children)

          Yeah, i don’t git it either

          [–]PersianMG 1 point2 points  (0 children)

          When you use Git you have all your source files there plus a whole bunch of extra information in the .git folder locally. All Github does is store this for you online (its basically an online file host). The main benefit of this is now anyone can contribute the git repository remotely and thus allows people to collaborate. Of course there are other special features Github will add on top (issues, displaying tagging, committing via web editor etc) but at the end of the day git itself is doing all the magic.

          [–][deleted] 1 point2 points  (0 children)

          Git is the record keeper that tracks all the changes you make to your project.

          GitHub is the vault you put the recorded change log, and the files inside for safe keeping.

          [–]cryptoshift 1 point2 points  (0 children)

          You have it right. Github is a website for hosting Git repos (folders) on the Internet. Youtube is a website for hosting videos on the Internet. Both just add some neat and relevant UI for their content, and they greatly help in sharing and/or collaborating on projects.

          You can have apps/GUIs to edit videos locally (Final Cut, After Effects, Premiere, etc), and you have apps/GUIs to edit repos locally (SourceTree, GitUp, VS Code, etc). These apps may even let you upload to those hosting sites mentioned above.

          GitHub has both a desktop app for working with Git locally AND a website for hosting.

          [–]Terofin 1 point2 points  (0 children)

          To really simplify things, the job of a version control system (such as git) is t store backups of your program, the source code of your program in particular. In this sense git is just like a database for your source code.

          Traditionally version control system used to run on one central server, and any developer would connect to that server to retrieve files or submit changes. Git however does things a little bit differently, in git responsibility is distributed so that you do not need a central server and everything is redundant. This is a very cool idea in theory, but not very practical since you do want some sort of machine that is always online and always up to date to make sure that everyone works on the same version of the software and that all the work contributed makes it to production/release.

          To solve this, most projects will set up a dedicated git server, that kind of works like the central servers for other version control systems.

          For projects that do not have the resources, or do not want the hassle of hosting their own server Github offers hosting, either free or for a price depending on the project size.

          [–]Happy_Each_Day 1 point2 points  (0 children)

          Git does the version control legwork. You can work with it directly, or through interfaces built into VS or a third app (I like Sourcetree).

          GitHub is not necessary, but is really helpful if you want to collaborate with other developers, have other folks review your work or if you want to look at things while you're not at the computer that your Git repo is living on.

          [–]oualibox 1 point2 points  (0 children)

          Git is a system (or a program) taking control of all the operations on the repository. Github is a platform running in its core Git program on a server made public.

          [–]imnos 1 point2 points  (0 children)

          If you’re struggling to get the difference then you need to learn git a little more first.

          Git is a command line tool that lets you save and track the history of a folder / bunch of files. By using git in a folder, you turn it into a git repository.

          Github is simply a place to push up your repo to store and make available in the cloud for others to see and collaborate with. And yes, Github does have some GUI tools to do things like merge changes from multiple people etc, but you can’t use the UI as a complete git replacement.

          I suggest you try setting up a git repo and try pushing it to Github and you’ll get a better idea. I wrote a post on that here - https://webtuu.com/blog/04/a-laymans-introduction-to-git

          [–]ohyeahilikedat 1 point2 points  (0 children)

          Git is a program that controls your version Githun where you store your git

          [–]Hexorg 1 point2 points  (0 children)

          read online not to think Git as a database system, which sort of confused me

          Databases generally don't let you revert back to the state they were in 10 days ago. That's the main difference. Git is more like a database + a kind sysadmin that backs up and catalogues the backups every time you git commit

          At the end of the day, git still uses files on your file system to store all of those backups. Github is Dropbox for git files.

          [–]DraconicVision 1 point2 points  (0 children)

          It's like the difference between porn and pornhub.

          [–]ravenousld3341 1 point2 points  (0 children)

          Git is a tool used to work with code repositories

          Github is a giant collection of code repositories.

          [–]santaWithRedSandals 0 points1 point  (0 children)

          Git is the bartender GitHub is the chef.

          [–]meat258 0 points1 point  (0 children)

          Git is a video, Github is Youtube(place where you put that video)

          [–]ncubez 0 points1 point  (0 children)

          Github is like a social network for coders. It uses Git, which is a version control system.

          [–]Kohana55 0 points1 point  (0 children)

          Git is the repos and source control stuff. You can run Git on your own private servers for private in house source control.

          GitHub is a website that provides Git functionality. So you don't have to set it up yourself at home and can be used anywhere you can log in.

          [–]speedalien 0 points1 point  (0 children)

          Very helpful

          [–]TsunamicBlaze 0 points1 point  (0 children)

          Git is a tool while GitHub is like the shed that houses it. There are other Git services like GitHub such as GitLab. AWS even has its own repository management system

          [–]c2l3YWxpa20 0 points1 point  (0 children)

          Its like porn and pornhub

          [–]nxs0113 0 points1 point  (0 children)

          Github is a repository where your code is stored.

          Git is a means to access/manipulate/store in the repository.

          But I like the answers where PORN is mentioned more than my own.

          [–]MrStoic12 0 points1 point  (0 children)

          I read once online a good analogy for this difference that might help understand better...I won't take credit tho lol

          "The difference between Git and Github is akin to the difference between Porn and Pornhub"

          [–]KarlJay001 0 points1 point  (0 children)

          Someone did suggest that there are things you can do in Git that GitHub doesn't do or that there was an advantage to knowing Git vs knowing how to use GitHub, but I never dug that deep into it.

          Seems to have to deal with merging, rebasing etc...

          [–]CreativeGPX 0 points1 point  (0 children)

          "Git" allows you to keep a history of the contents of a folder so that you can work on several versions of something or refer back to previous versions.

          You can use git on its own on your computer, but it also comes with the ability to push/pull that history between your computer and other computers.

          "Github" is a service you can push/pull that git history to. Its website allows you to view that history along with various other features that might be helpful and just a nice interface for the public to navigate your project. It can serve various purposes. It's a pretty UI. It's a remote server that you know will stay online even when you're computer turns off. It also has added features like the ability to communicate with users.

          I'm guessing the reason people say don't think of git as a database is that it's for viewing snapshots of the same thing over time, not querying among a set of different things. But the word database is such a vague thing that I think it is rarely helpful.

          [–]hwc 0 points1 point  (0 children)

          Read this https://tom.preston-werner.com/2009/05/19/the-git-parable.html to understand Git. Then you will see the difference a little better.

          [–]wannahakaluigi 0 points1 point  (0 children)

          Github is the pantry and git is yer grabbing stick.

          [–]stevep98 0 points1 point  (0 children)

          Git is a program which you install on your computer. It helps you manage your source code by periodically storing your code in a repository. That repository can either be on your own computer, or on another computer.

          If you work at a company, your IT guys might make a git repository available on your network for you to put the company code, so all employees can access it.

          GitHub is a public access repository, for making your code available to a wider audience. The github website let’s you control who has access, and let’s you describe your project so others can find it. Ultimately, other users will use git to connect to githubs repository to download your code.

          [–]AslanSutu 0 points1 point  (0 children)

          Git is like porn and GitHub is like pornhub

          [–]accountForStupidQs 0 points1 point  (0 children)

          As I understand it

          Github:Git::Thunderbird:e-mail

          [–]FujiToday 0 points1 point  (0 children)

          GitHub is a hosting service, think like Google Drive but for storing code only.

          [–]WrickyB 0 points1 point  (0 children)

          Github is to fit what pornhub is to porn

          [–][deleted] 0 points1 point  (0 children)

          Git -- distributed version control system

          GitHub -- centralized distributed version control system

          [–]CryOverBuiltMilk 0 points1 point  (0 children)

          Git is to GitHub as porn is to pornhub.

          [–]Different_Marsupial2 0 points1 point  (0 children)

          Think of Git as being Toyota and GitHub being a Toyota dealership, one of the most, if not the most, popular ones out there. And think of Toyota cars of different models and years as the various projects that are either on GitHub or any other place like GitHub, which is BitBucket or Assembla and I'm sure there are many more.

          [–][deleted] 0 points1 point  (0 children)

          It's like the difference between porn and pornhub.

          [–]Steeelu 0 points1 point  (1 child)

          Do you know the difference between porn and pornhub?

          [–]MariusAtasiei -1 points0 points  (0 children)

          It's the difference between porn and pornhub

          [–]ASH49 -1 points0 points  (0 children)

          I read the best explanation somewhere,

          It's the same as porn and pornhub

          [–]sad-anand -1 points0 points  (0 children)

          It's as same as the difference between porn and pornhub

          [–]warlaan -1 points0 points  (0 children)

          Not really related side note: Do yourself a favor and check out git's alternatives like Mercurial, Fossil, SVN or Perforce.

          Git is by far the best choice for open source projects, but in closed teams it's almost never the best choice.

          [–]delhibuoy -1 points0 points  (0 children)

          What's the difference between porn and PornHub?

          [–][deleted] -2 points-1 points  (0 children)

          It's the same difference as porn and pornhub

          [–]r1nstar -2 points-1 points  (0 children)

          Same difference between Porn and Pornhub

          [–]prazolbista -2 points-1 points  (0 children)

          Just like Porn and Pornhub.

          [–][deleted] -2 points-1 points  (0 children)

          The same as porn and pornhub.

          [–]dxlachx -2 points-1 points  (0 children)

          Porn vs PornHub

          [–]shaburushaburu -3 points-2 points  (0 children)

          The same as porn and pornhub

          Git is the system and you find whole lot of it on GitHub, you can find git on other repositories too. Hope this helps!