Git Basics, Part 1

Suppose you are using a computer, like you are doing right now. You probably use it most of the time to browse the web, but you also use it to create content. Suppose you are working on an essay, for example. Have you ever been in a situation where you were creating that essay, and you thought, ‘I wish I could just go back to how this essay was before today?’ No? How about that one time where you accidentally deleted all the files on your flash drive… Interested now? Git and its remote service, Github allow you to solve these problems in an extremely elegant fashion, by keeping track of versions whenever you tell it to. This has helped programmers around the world to collaborate on projects, independent of how well they know the developer!

Git is a very complicated but useful piece of software, and fully understanding it can take years of experience. However, this does not stop one from using it productively! To get started on windows, you can install git from here. Here are some terms important for you to learn, ones that you will be using every day when using git:

  1. Commit- In its simplest form, it is a version. When you want to save a version for future reference, or for backup. This can be as simple as a single addition or a large feature set (in a program). If you get confused, read commit as ‘change’
  2. Repository- Where the things you want to version control are. It is usually a folder on your computer. When you make a commit, files from this folder will be added to the repository, and will be kept version controlled. In git, every computer involved has its OWN FULL copy of the repository. To make changes, you commit then distribute them to other members.
  3. Push- A push is where you move commits from one copy of a git repository to another copy (usually on different computers).
  4. Pull- A pull is where you get new commits from another repository, to update your copy.
  5. Branch- This is a slightly advanced concept that describes a point where commits diverge. Suppose you make a commit (change). Then you reset your computer to before you made that commit, and make a different commit. The paths have diverged between these two commits, they are on different branches. Its ok if you dont understand this, I will talk about it more later!
  6. Rebase- A more advanced concept that I will talk about later. (It requires you to know about branches).

Also, keep in mind, git works best with pure text files (like code files). It works, but extremely inefficiently on other types of files. Next week, we will start with creating your first git repository, making a commit, and saving your code (or text) up on github!

– [onion] chesse

Advertisements

4 comments

  1. This post was great, as a “stupid user” this blog really sparked my curiosity because i have lost a whole nights worth of work one to many times. I know absolutely nothing about computers other than browsing the internet and doing school work and the GIT program made me realize that a basic understanding of the inner workings could be very beneficial. I can truly see your love for the old way of computing in your blog and the way you present your writings with coding snip its proves to all your readers that you know what you are talking about. Your blog is extremely relevant at a school like Tech and I’m sure is enjoyed by many; however, as someone that doesn’t know much about computing maybe a little more basic explanations. I found myself lost in certain instances and almost everything going over my head. But all in all great job with your blog! Keep doing you.

    Like

    1. Thanks so much! My blog is aimed at targeting the users just like yourself who want to learn more about computing, and I am glad to see you are interested! If you find any trouble with any of these guides, or want to learn anything about a specific part of computing, I can help you out!
      – [onion] chesse

      Like

  2. Interesting! I’ve never really been interesting in coding or computer science or any of that stuff because I feel like I am not smart enough to touch any of that stuff, but your blog gave me a little self belief in saying “Hey you stupid person! You can do this too!” haha. You lay out every step very clearly, and I will definitely be trying this once I have the time. Thanks!

    Like

    1. You are 100% correct in saying that, you can learn things too! Its not just these tutorials, there are hundreds of thousands of articles, videos, and walkthroughs on the internet for the sole purpose of helping you to understand whats ‘under the hood’. After all, you’re typing this on a computer, so you have all the tools you need to become the best computer scientist out there!

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s