Vickerdoodle

thoughts, opinions, and random arts & crafts

Technology

Things I’m Learning: Git and GitHub

August 6, 2017 · 3 Comments

I’ve been doing the 100 Days of Code challenge, and it has been incredibly rewarding. The tl;dr of it is, you commit to coding for at least 1 hour every day for 100 days. You hold yourself accountable by keeping a log on GitHub and also tweeting about it every day. I originally started this challenge just to keep myself accountable and “force” myself to set aside time to code every day. It’s actually turning out to be a lot more than I expected. For one thing, you end up getting an amazing community on Twitter. I didn’t expect so many people to comment on the things I’ve tweeted, offering advice, suggestions, and just overall support.

The first thing I had to learn was how to use Git/GitHub. I’m not an expert at it in any way, shape, or form. But I feel that I have a working understanding of it now. Here’s some things that I’ve had to go through in order to figure out how to use Git/GitHub, and some resources that I’ve used.

What is Git/GitHub?

Git, as I understand it, is a version control system. It allows multiple people to work on the same project without stepping on anyone’s toes or messing up anyone’s code. Have you ever had one of those moments where you’ve been working hard on some code, you run the code, and suddenly everything melts down? (And you’re left freaking out?) Git gives you the ability to version control, so that you can see the changes made and go back to the version before everything went haywire. It also allows everyone working on the project to see the changes that have been made each step of the way.

GitHub is basically an online “hub” for Git. It’s a nice way to visualize all that version control stuff. (I’m so technical, I know.)

Why use it?

At this point in my “career,” I suppose I don’t really need Git. I’m a lone developer working on my own projects, so there’s no collaboration. Still, GitHub has a wonderful social aspect. I may not need any collaboration tools, but version control and logging is super useful for beginners like myself. I can go back through my commits (more on that later) to see the changes I made and how I did things. I can version control when my new kitten decides to step all over my computer, typing lines of not!code. (Seriously, that just happened.) And I can use GitHub as a public portfolio for my code. It provides a beautiful timeline on projects I’ve worked on and the longer I use it, the more it could help in displaying my growth as a developer.

Basic terms

Currently, I really just use Git for version control and logging. So if you’re looking for some in-depth tutorial, you may way to scroll a little further to the links. But hey, the first step to understanding is to be able to explain it to someone else. So here are the terms I use most often: (Before you start though, you should maybe make sure Git is installed on your computer!)

  • repository – when you start a new project, you need a repository (or repo) for it. It’s basically like having a folder to house all your stuff.
  • git status – is a way to show you which files git already knows. It will let you know all the changes that have been made thus far, which files are ready to commit, and all that jazz.
  • git commit – creates a log of that file. Every time you commit, you save a copy of those changes
  • git commit -m "comment goes here" – it is generally a good idea to leave yourself a little comment or two when you commit.
    “changed around the syntax” or “completely deleted the paragraph my kitten typed for me” will do nicely.
  • git add – but before you can commit anything, you have to make sure those files are added to the so-called “staging area”.
    It’s kind of like putting the food you’re about to eat on your plate, I guess?
  • git push – you could stop at commit. But if you want to save everything on a place like GitHub or somewhere else more public than your personal computer, you’ll have to push those commits.

Resources

Was that informative? Probably not. Here are some resources that I used while learning, and my thoughts on them:

  • Apparently you can skip a lot of manual steps by downloading GitHub Desktop! A lot less typing on the console and a lot more drag-and-drop, as I understand it. In my attempt at trying to learn and do from scratch, I’ve actually been manually typing everything out on the console. But I’m told that this is a really good tool to have.
  • Try Git is the first tutorial I tried. It’s written by Code School and sponsored by GitHub. It’s also presented in a super cute way. Unfortunately,
    it didn’t work out too well for me. I think I’m more of a learn-from-doing type of person, and this just wasn’t do-it-yourself enough for me. Perhaps it’s the fact that they let you simulate everything on their little tutorial, and I would have liked to do everything on my computer to see what it’d be like? Either way, it offers very good, basic information. But I wouldn’t say it’s enough to really understand what you’re doing. (Incidentally, it’s the first in a series of Git tutorials at Code School. It’s the only free one, so it was the only one I took. I imagine the next few courses, which are paid, may offer a lot more.)
  • After Try Git failed, I ran into An Intro to Git and GitHub for Beginners (Tutorial) via a google search. I really recommend this article. It’s fairly basic, but offered me all the information I really needed at this point in my Git journey. It even has really nice screenshots for those who are more visual learners. This was where I learned the bulk of my Git/GitHub.
  • Udemy also has a lot of pretty good Git/GitHub tutorials. They’re more video based and go into a lot more details. You can often catch Udemy on some really nice sales and you can end up taking the course for $10 if you time it correctly.
  • Finally, the ultimate tutorial series, How to Contribute to an Open Source Project on GitHub from Egghead.io. It’s pretty much all of the above, bundled together, and free. I actually discovered this through some helpful twitter users who responded when I tweeted my Day 0 #100DaysOfCode struggles with Git. If you’re a visual learner, this series is great. If you’re good with just reading with some occasional pictures,
    the above mentioned Intro to Git and GitHub for Beginners is probably enough. But if you’re looking for more interactive learning, or even if you’re just looking to get more detailed, definitely watch this series. It’s golden.

How did you learn Git? What were your struggles/successes during that process? I’d love to know! 🙂


Tags: , , , , ,

3 thoughts on “Things I’m Learning: Git and GitHub

I gave myself an account a while ago since I provision enterprise GitHub accounts all the time at work, but I never really figured out how to use it. I didn’t realize it was so complicated and robust in features…. WELP.
One of these days, I’ll figure it out… XD

That’s awesome that you’re doing a coding challenge and that it’s going well for you! We use Git at work, though we originally used SVN a long time ago. Git is actually great for solo projects too! It’s super useful when you need to revert your work back to an older revision. Without version control, it’s hard to remember what the code used to be or where the breaking point was.

I mainly learned svn and git through “doing” because it was required at work. I still have to look up things once in a while, especially around reverting and merging. I suggest looking into git aliasing if you haven’t already! I find that “status” is annoying to type over and over, so I’ve aliased it to “git st”. I’ve also aliased other longer commands that I have to frequently do.

Git stash is also really, really useful. It lets you temporarily stash your changes if you need to switch to another branch before committing. Other than git st, my most used command might be git diff since I like to see my changes along the way and before I commit.

Good luck on the challenge!

Git is seriously awesome, it’s great that you’re learning it! I started using it when I switched jobs a couple of years ago. I find that tutorials are good for basic understanding, but to actually learn how to use something (git or whatever else) I very much prefer having a real project and sort of figure things out as I go. That’s usually the best and fastest way, at least for me 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *