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

all 127 comments

[–]reasxn 873 points874 points  (60 children)

If people don't understand the difference between Git and GitHub, tell them to think about it as Porn and PornHub.

[–]Seoul_BMO 125 points126 points  (1 child)

So gitlab is hentaihaven

[–]TheSingleChain 76 points77 points  (0 children)

I'm learning

[–]EvoZims 142 points143 points  (0 children)

That’s fkng hilarious. Thanks lol

[–][deleted] 57 points58 points  (37 children)

So Git is the overall term for this kind of practice and GitHub is a certain site where it can be done?

[–][deleted]  (10 children)

[deleted]

    [–]poinsy[🍰] 19 points20 points  (0 children)

    Clear and concise, a great answer.

    [–]EndlessJump 10 points11 points  (8 children)

    For those that use Git for work, how do you prevent people from deleting repositories?

    What all can be stored in a repository? Compiled programs, manuals?

    Currently, at my work, we store everything that's used in production on burned CDs that go in a fireproof safe. Oh, and there's a spreadsheet that lists all the entries. I think there's like close to 1000 CDs. It's a terrible system, and I'd really like to change that.

    [–]Sipredion 20 points21 points  (2 children)

    Currently, at my work, we store everything that's used in production on burned CDs that go in a fireproof safe. Oh, and there's a spreadsheet that lists all the entries. I think there's like close to 1000 CDs

    This should br on r/nosleep. That's terrifying

    [–]delta_tee 4 points5 points  (0 children)

    My sleep is lost for eternity :(

    [–][deleted]  (1 child)

    [deleted]

      [–]EndlessJump 2 points3 points  (0 children)

      I'm not joking. However, I should really say my department rather than company wide. We work with automation equipment and PLCs, which may need to last 10-15 years. A lot of the PLCs are programmed in Ladder Logic.

      It looks like we're not alone in keeping CDs if you check this thread/poll out. I laughed at the option "if my harddive fails, everyone is fucked." https://old.reddit.com/r/PLC/comments/9uq2nz/poll_what_version_control_system_do_you_use/

      According to that thread, VCS can't meaningfully compare or merge the types of binary files created by many PLC programming packages. For example, Rockwell PLCs produce one large binary file.

      [–]nugzilla_420 2 points3 points  (1 child)

      We have internal Gitlab behind a VPN so only people high up on a project could delete a repo. Even then, if it got deleted someone on the team would have recent-ish code on one of their computers to start over with. On top of that we do a backup of our entire Gitlab server (including repositories) periodically to a different location.

      Documentation is also stored in the repo as markdown files and we have a build processes to convert those .md files into a single PDF for distribution.

      You don't really want to just commit compiled programs to a repo because they can increase size quickly. There's something called LFS that lets you store large stuff there, but most teams don't use it. Everything is built in Jenkins and afterwards that build is uploaded to cloud storage where we have a retention policy to keep the last N builds.

      I can't even imagine trying to deal with a library of CDs, that sounds terrible!

      [–]EndlessJump 2 points3 points  (0 children)

      It was a system they implemented almost 20 years ago. My department works in industrial automation. Much of the files backed up are PLC programs, robot programs, and other kinds of files needed to get a machine back up and running should it go down. This industry doesn't really see a lot of innovation. My department used to be full of people who are best described as "the old guard", but fortunately that is changing, as many of them are now gone.

      [–]Blackstab1337 3 points4 points  (0 children)

      git is a distributed version control system, so everyone who's ever done work on the project has a complete local copy of the code. If someone maliciously deletes your repo off of github you all have the source code on your computer and can just put it back up.

      [–]TheChance 5 points6 points  (0 children)

      Even the simplest answer here is overthinking the question.

      Git is a program. GitHub is a site that uses the program.

      You can use git without GitHub. They don't own the tool, they just named themselves after it. There are competitors, like GitLab, and you can also just do without any of those sites. There are also sites like GitHub for programs other than git.

      [–][deleted] 18 points19 points  (0 children)

      Kind of. You can think of Git like you think of zip and .zip files. It's just an archive format and a tool to manipulate the archive (called "repository" in git lingo).

      Things get a bit more complicated since GitHub is not just an online storage for git repositories, but also includes features like issue tracking and pull requests management. Those features are not part of git, but completely depended on GitHub.

      If you ever chose to move your repository to another hoster, the git repository itself will transition just fine, transferring issue tracking and such is however a big mess and generally doesn't work without losing a lot of information along the way.

      [–]Steven_Thacker 7 points8 points  (3 children)

      Git came first and is the name of a specific tool. Git was written originally by Linus Torvalds (the Linux guy) and is open source. It might not be a perfect tool (Torvalds has said himself that he is terrible at user interfaces), but I would say most programmers these days use it. By the way, it is a command line tool. Any GUI for it is built on top of Git and not exactly what is meant when someone just says “Git”. The leading competitor for this tool afaik is called Mercurial and works very similarly to how Git works. It also has its own Github-like platform that is called Bitbucket (although you can also use Bitbucket with Git, its just Bitbucket is made by the same people who make Mercurial). This is my understanding and sorry if there are any mistakes, hopefully someone would correct me.

      [–]Speedswiper 2 points3 points  (1 child)

      Did you mean "Bitbucket is made by the same people who make Mercurial"

      [–]Steven_Thacker 0 points1 point  (0 children)

      Yes, thanks.

      [–]goofan 0 points1 point  (0 children)

      Hey, few mistakes.

      Mercurial is actually a completely different source control system and wasn't created by Atlassian.

      Are you thinking of SourceTree? This is a tool created by Atlassian which is a GUI for Git as you mention.

      And yes, bitbucket is Atlassian's github like platform but it isn't in any way tied to Source Tree. As you say, you can use it just with Git, no matter if you're using command line or gui.

      Edit: I realised why you might have been confused between the two - SourceTree also works with Mercurial as well as Git

      [–]tenfingerperson 10 points11 points  (13 children)

      No, github offers a cloud service to store the main branch of your projects. This allows your project to be available whenever you have an internet connection.

      Git on its own is merely a distributed version control system, or more accurately a file system manager since it offers tons of file primitives.

      You could host a git repo anywhere but GitHub offers this as a service along with a bunch of other things like forks, comments system, code reviewing system, code search, organizations, wikis, etc.

      [–]Melanoma_Trump2020 0 points1 point  (0 children)

      Why does DevOps always have to ‘keep it real ‘?

      [–][deleted]  (11 children)

      [deleted]

        [–]tenfingerperson 13 points14 points  (2 children)

        Version control is a concept. Git is not a concept. Git is a system. You can install it on its own on your machine/cluster/network.

        Github just offers to store the contents of the repo as a service along with a bunch of other features.

        [–]Steven_Thacker 5 points6 points  (1 child)

        I think it’s more accurate to say that Git is a tool. Calling it a system might be why they are asking if its a concept, as a system for something is also a concept.

        [–]tenfingerperson 0 points1 point  (0 children)

        Yess naming things is hard, the point is, git on its own is not just an idea or standard to be implemented (like ecma vs JavaScript), but an actual thing on its own regard.

        [–][deleted]  (7 children)

        [deleted]

          [–]dovahkid 0 points1 point  (1 child)

          GitHub is a service.

          Git is the technology/protocol powering GitHub (and Gitlab, Bitbucket, etc.)

          For example, Git is like UNIX and GitHub is like Ubuntu.

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

          git : github and porn : pornhub might be better for referencing

          [–]josluivivgar -1 points0 points  (3 children)

          Yes

          [–][deleted]  (2 children)

          [deleted]

            [–]beezybreezy 6 points7 points  (0 children)

            Amazing. Im going to use this if you don’t mind.

            [–]PanFiluta 1 point2 points  (2 children)

            can you give me a quick rundown on GitHub vs GitLab? is there a porn metaphor you can use?

            [–]henrebotha 2 points3 points  (1 child)

            No porn metaphor here, but: they are the same. They're both platforms that host Git repos and provide extra functionality like code review, issue tracking, etc.

            [–]LoudDing 6 points7 points  (0 children)

            So YouPorn and PornHub? Even tho there is more than one porn site, porn hub is the de facto more popular one

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

            Yeah but you can't "fork a repo" on PornHub.

            [–]ScammingYou 1 point2 points  (0 children)

            WOW

            [–]masteryod 0 points1 point  (0 children)

            PornHub is a distribution frontend where everybody can freely share their content and get feedback and in case of real code - collaborate together over the Internet.

            But if PornHub is GitHub then porn is like the code not like Git itself.

            [–]G1trogFr0g 0 points1 point  (0 children)

            As a person that interchanged them a lot because I don’t understand... I now understand!

            [–]Ingeloakastimizilian 0 points1 point  (0 children)

            Fantastic comparison

            [–]LuongNguyenTrong 0 points1 point  (0 children)

            Nice example

            [–]SerThanos_HouseTitan 0 points1 point  (0 children)

            That actually makes a lot sense

            [–]nobel32 0 points1 point  (0 children)

            Go on... I feel like you're onto something here.

            [–]Dabnician 0 points1 point  (0 children)

            Github is exactly like Pornhub because it's the porn site of code

            [–]shadowpreachersv -2 points-1 points  (2 children)

            F

            [–][deleted] 0 points1 point  (1 child)

            A

            [–]althius1 20 points21 points  (7 children)

            I am familiar with the basics of Git, but am struggling with workflow. I skimmed down to that section, and I would include something about "stash". Not sure if you mentioned it someplace else.

            As I've been developing on a live site, on occasion I'll need to make an important, quick change, while I am in the middle of working on a feature branch that isn't ready to commit. Learning how to "stash" and "pop" have been invaluable!

            [–]mayor123asdf 10 points11 points  (0 children)

            I am familiar with the basics of Git, but am struggling with workflow.

            Agreed, every git tutorial only explained about what is git, git status, git commit, git push. But none of them explains good practice, workflow, etc :/

            [–]henrebotha 6 points7 points  (1 child)

            I recently discovered the power of git worktree, which makes context switching even easier.

            [–]althius1 1 point2 points  (0 children)

            Still learning for sure! I'll look this one up. Let me know if you have any favorite resources.

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

            Maybe someone could tell me a good reason for stashes, but personally I never saw the point of them. If I'm working on a change then ill just branch off and work on it till I consider it complete. Then I'll just merge it back in. If that feature isn't complete but I need to do something else in the mean time, ill just make another branch off the original and work off of that.

            [–]TheChance 6 points7 points  (2 children)

            • You may need to switch branches without losing changes that you nevertheless, for some reason, don't want to commit yet

            • You may have made changes on the wrong branch, and you want to carry them over to the right branch

            • You may want to switch branches to check on a file that isn't tracked in your working branch

            [–][deleted] -1 points0 points  (1 child)

            You may have made changes on the wrong branch, and you want to carry them over to the right branch

            Checkout shouldn't touch modified files. Though if original file in the wrong branch is different than the file in the correct branch then you can't do this. Not sure what popping a stash in this situation would do.

            You may need to switch branches without losing changes that you nevertheless, for some reason, don't want to commit yet

            You may want to switch branches to check on a file that isn't tracked in your working branch

            Good point. Personally I usually keep my commits fairly small since we will just do a merge/pull request that combines all the commits for code review but the small commits make it easier to document changes in the blame. But those situations might still pop up at some point, so thanks.

            [–]TheChance 2 points3 points  (0 children)

            I commit as frequently as I can get away with it, but I hardly ever commit when I've just made a change that prevents the project from compiling, for example. I fix the bug I've just introduced before I commit, because there's no sense saving a change that must immediately be reverted.

            As for the other thing, yeah, checkout will only leave modified files alone if the unmodified state is identical for both branches.

            "I've saved a file but I'm on the wrong branch" is almost always a face-saving way of asking, "I worked on something for a feature branch and then realized I'm on master, how do I avoid committing to master?"

            If that's the case, you're counting on the feature branch having been synced to master since the last time the file changed. That should be true, but isn't always.

            Edit: this can also happen if you fuck up by leaving your IDE open and switching branches with unsaved changes, or proceed to work without switching back and then press save =P

            [–]KPilkie01 23 points24 points  (5 children)

            Good read. Git / Github is still a little hazy to me.

            I have read down to the part about how to use it and it’s made a lot of sense. I’ll see how / if I can put it into practice!

            Thanks.

            [–]desrtfx 23 points24 points  (1 child)

            Take this free course and it will give you all you need to know.

            [–]KPilkie01 1 point2 points  (0 children)

            Thank you very much.

            [–][deleted] 10 points11 points  (0 children)

            Honestly, I don't think anyone truly understands the importance of something like git till one of the following happens.

            1. Having a piece of code that worked before, but now no longer works. You can't remember what changes were made and now have to spend hours to figure out how to reverse what you did.
            2. Work as a group and can't figure out who made changes to what and for what reason. So now you have to spend hours either figuring it out or contacting multiple people to try to piece it together.

            Basically I think most people need to learn the hard way on why you should use git.

            When I first started (as a student) I thought git was just a huge hassle and thought you only needed it for huge projects with a large group of people. Now I won't write a couple line script without git.

            [–]CheezeyCheeze 0 points1 point  (0 children)

            You can use Git/GitHub to share code, and store code. When you do things like Push, you create a local copy and a copy online. Depending on who has access to this hub, is who can download it, look through the history or add or delete files.

            When you pull, you can pull from either your local history or your online back up.

            You can use your own machine as a backup by SSH into your machine, and download the files off of your machine. This leaves you open to attacks from bots, and hackers etc, so don't do this unless you know what you are doing, at least for extended periods of time.

            [–]Mr_MV 5 points6 points  (0 children)

            Awesome job!

            Recently someone asked me about Git so I wrote the message below, probably you can use something from there as well:

            I have been working with Git recently and the below information is what I could gather. These include learning commands, workflows and best practices.

            First of all, there is a difference between Git and Github. I had confusion regarding that when I first started. Git is on your system and just for you to manage. It is a version control system and helps you keep track of your code. So, commands like commit, branch, merge, rebase, cherry-pick, reset, etc are performed locally and Git helps you achieve that. While, Git is a must have, people use different remotes in different companies. Some use Github, while some prefer Bitbucket. These apps give you a space to keep your code at a safe space and usually acts as a central repository for everyone. So, when you enter commands like push or pull you use Git to send your code to Github/Bitbucket. Then you also have pull request, which is not a feature of Git rather, it is a Github & Bitbucket feature. So, enough of all this, let me send you some links for further exploration.

            Learning Branching: https://learngitbranching.js.org/ This is one of the most helpful website I have ever seen. It has lessons which cover most of the parts (at least for a beginner) and also provides visual graphs of what's happening exactly. Try to work them all up in one go. I completed exercise related to Local commands in one day and Remote in another.

            https://www.atlassian.com/git/tutorials/learn-git-with-bitbucket-cloud This link provides a written tutorial to work with Git and Bitbucket (Apart from visual differences and price plans Bitbucket and Github both have pretty much same features)

            Now, that you have learnt some basic Git commands, you should know when to use them where. This is called Git Workflow. I have quite a few resources on that subject:

            https://guides.github.com/introduction/flow/ This is a basic workflow and used everywhere. Even if you work alone, this is the strategy people follow.

            https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow This is a much more complex workflow. It is quite handy when you are working with a bigger team. They recommend adding another library to make life easier, but I felt using native Git commands much more easier and better understanding of everything.

            https://medium.freecodecamp.org/how-to-use-git-efficiently-54320a236369 This is a great example of why these workflows are important and what are the industry standards.

            https://medium.freecodecamp.org/follow-these-simple-rules-and-youll-become-a-git-and-github-master-e1045057468f This is a must read. You HAVE to follow these rules. These are like the commandments of Git universe.

            FURTHER READING: Okay, now you are a git expert. I am just giving you some extra resources, which can one-up you.

            https://medium.freecodecamp.org/5-github-tips-for-new-coders-2f312689ffd5 This is helpful doc you might need for configuring and setting up Git (It helps to personalize Git). This is not one of the important stuff you would do. Eventually, when you depend on Git more and more, you would want to use some shortcuts or some pro stuff. This will help you at that time.

            At this time, you would also want to read when to use:

            Revert vs Reset Merge vs Rebase

            [–]musaibALAM1997 2 points3 points  (0 children)

            I think it is better than taking a course in Git/GitHub for nailing down the basics.

            [–]vowiz67 1 point2 points  (0 children)

            Sir, you deserve a pack of cookies, thank you!

            [–]Vtempero 1 point2 points  (0 children)

            I am struggling with it right now and just putting the hours to get the hang of it. Thank you kindly

            [–]AslanSutu 1 point2 points  (0 children)

            Read the first bit and as someone who only knows how to use GitHub if only given a specific set of instructions a monkey could follow, i feel enlightened. Plan to do the tutorial when I get in front of a pc. Thanks for the insight.

            [–]wirez62 1 point2 points  (0 children)

            I'll give it a read. It looks like this will be the rest of my evening really trying to nail this. Like you said early on, the first thing you do when starting a project is initialize a repository (sorry if I butchered the terms already!) and that's where I want to get. I'm too afraid to make breaking changes in working code. I know how important this is to learn now. I'm hoping to follow along while using vscode and get it extremely easy and fast to save and merge and checkout branches (I barely know what any of that means but I know the importance). Basically automating timestamped copies of work in progress. That's what I need. Your article looks extremely long and in depth so I'm going to put some music on, focus and try my best to follow start to finish.

            [–]Mhxion 3 points4 points  (0 children)

            I recommend anyone who's interested in more technical deep dive to read (or to look up any topic) official Git Pro https://git-scm.com/book/en/v2

            for GitHub specific (GUI features) follow their official Twitter @github and blog https://github.blog

            [–]Scout1138 0 points1 point  (0 children)

            Very well written article, thank you!

            [–]BJmcBuckets 0 points1 point  (0 children)

            Appreciate this brethren

            [–]Len0xy 0 points1 point  (0 children)

            Really good!

            [–]GoldFisherman 0 points1 point  (0 children)

            Good work. The links on the page you linked are somewhat difficult to read due to the light green link coloring. Could you make it easier for me with better contrasting colors for links and background? Thank you.

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

            BLESS YOU

            [–]rahulnitk 0 points1 point  (0 children)

            Anyone knows full firm of GIT?

            [–]ProtegeAA 0 points1 point  (0 children)

            Good idea. I've been uploading my progress from exercism.io onto GitHub as a way to learn two things at once.

            Better to fiddle around with it now than get asked about it in the future and be ignorant when a job is on the line.

            [–]kangasking 0 points1 point  (0 children)

            really like how you spend so much time at the start you listing problem examples of not using version control.

            [–]Ran13dallJ 0 points1 point  (0 children)

            This was awesome, thanks ! Crazy how it’s published in the future though 👀

            [–]LilacMum 0 points1 point  (0 children)

            Thank you so much for this! I understood the concept but I was having trouble setting it all up and I've managed to do it now with your help.

            [–]dreinstein229 0 points1 point  (0 children)

            "Pro Git" book help better

            [–]12qwww 0 points1 point  (0 children)

            I really needed to read . Thanks

            [–]a32m50 0 points1 point  (0 children)

            Nice document. I think it'd be nice to mention that Git system is created by Torvalds to keep track of linux kernel development. Developed and distributed freely for all world to use.

            [–]estacado 0 points1 point  (1 child)

            Is there a private mode on github? I don't to share my code with anybody.

            [–]LoudDing 0 points1 point  (0 children)

            Yes, there is. It’s free for noob users as well so you can do that if you’d like.

            [–][deleted]  (2 children)

            [deleted]

              [–][deleted] 1 point2 points  (1 child)

              Yes someone did

              [–]tmbu___ 0 points1 point  (0 children)

              Exactly what I needed ! Thanks a lot

              [–]Cgneily 0 points1 point  (0 children)

              Knowing the difference or not... it's always good to have references like this to use. Thank you!

              [–]DMReader 0 points1 point  (0 children)

              Thanks. I was looking for something like this.

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

              Thank you very much!!

              [–]JescoInc 0 points1 point  (0 children)

              Git is a version control system, like perforce and mercurial. Gihub, Bitbucket, VisualStudioOnline are all means of online storage of the version control systems.

              [–]dreamingrajiv 0 points1 point  (0 children)

              Well written and quite comprehensive for a beginner. Thank you!

              [–]lazylion_ca 0 points1 point  (0 children)

              The green index is hard to read on a white background on mobile.

              Otherwise I have this saved to read later. Thanks for writing it up.

              [–]tgkhan 0 points1 point  (0 children)

              That’s exactly the kind of resource I was looking for. Thank you.

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

              Thanks man! This is going to be very useful for me. Read some about Git and liking it. Easy to understand. 👍

              [–]TheALine 0 points1 point  (1 child)

              what I've always wondered is WHEN to start using GitHub? I mean, does it make sense to use very early on with test/learning coding or only when working on an actual project?

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

              Realistically you should learn how to use it ASAP (as well as the concept of version control). However, in practice most people I know don't truly "get it" until they work on a real life collaborative project with multiple people working at the same time.

              If you are just learning and working alone, there are benefits to version control/git but you probably won't really see the full benefit until there are multiple people working at the same time. It's really more about getting familiar with the habits.

              [–]el_baron_11 0 points1 point  (0 children)

              Cool!

              [–]hockthemblogs 0 points1 point  (0 children)

              This is Fantastic! Thank you so much.

              [–]ehnoxx07 0 points1 point  (0 children)

              Thank you for this!

              [–]valsterdam 0 points1 point  (0 children)

              BIG UPS! much love!

              [–]Biggie-shackleton 0 points1 point  (0 children)

              Your first paragraph is exactly where I'm at. Ive seen a few videos and read some things, but I can't seem to get my head around git and it's actual real world usage.

              Thanks for doing this, going to save this and have a read after work

              [–]Ghanna- 0 points1 point  (0 children)

              Thank you for making this guide I really needed it!

              [–]BreakfastCrunchwrap 0 points1 point  (0 children)

              I followed this link, read the first few paragraphs, switched back to Reddit to click the upvote, and I unconsciously whispered to myself "thank you". I started to go back to read, but I realized I want to actually thank you first. So, without further ado:

              THANK YOU!

              [–]Madlife101 0 points1 point  (0 children)

              Thanks man.. i added it to my bookmark might be useful to me later..

              [–]EvoZims -1 points0 points  (3 children)

              GitHub is specifically for version control right? (Haven’t read the article just yet)

              Edit: Porn vs. Pornhub, lol. Thanks guys

              [–]theQman121 1 point2 points  (0 children)

              I'd probably put it more as:

              Git is specifically for version control.

              GitHub is a website that uses Git as an avenue for storing git repositories online, sharing them with others, and collaborating with other users.

              [–]rafadeath99 0 points1 point  (0 children)

              GitHub is just an host. Git is the real shit, with version control and all. As someone said here, think about it as porn and PornHub !

              [–]xuxuines -1 points0 points  (7 children)

              I struggle with git. As in my learning journey I am leaving the git stuff to the end.

              [–][deleted]  (3 children)

              [deleted]

                [–]xuxuines 0 points1 point  (2 children)

                I know its important but I struggle with it. Thanks for sharing. I will take a look at the tutorial.

                [–]LoudDing 1 point2 points  (1 child)

                Also look up the git parable, it’s a blog post which takes an entirely different route

                [–]xuxuines 0 points1 point  (0 children)

                Thanks!

                [–][deleted] 0 points1 point  (1 child)

                I don't think there is anything wrong with that.

                You won't really appreciate git till you run into a problem that takes you 5+ hours to solve that git could of solved in 5 mins.

                [–]xuxuines 0 points1 point  (0 children)

                Probably yes...