How to Use Git: A Beginner’s Guide
When I was learning how to use git a few years ago, all of the tutorials had this picture of these lines, dots, and arrows like a metro map. It didn’t make sense, and don’t worry, this is not one of those tutorials. If you’ve been searching around the web, I’m sure you’ve seen the images. They look kind of like this: This is a confusing git illustration The problem with these illustrations is that while they make sense to someone using git on the regular, they are absolutely positively confusing to someone learning git for the first time. I think a better place to start is by explaining what git is not. One of the most common misconceptions that I see with inexperienced developers is mistaking git as a shorthand nickname for GitHub. Git is not GitHub. GitHub is a social cloud platform to contribute code, submit bugs, read about software, and share projects. Experienced developers understand that it includes git as a feature, but if you don’t understand git, you might simply store projects in GitHub repositories without understanding how to use the platform with the git feature. I have seen beginners use GitHub as a cloud library of projects to download and upload, and never use the git feature. Git is something that can be used without GitHub. It can be used on its own on your desktop or with other cloud repository tools such as GitLab, Azure, JIRA, etc… It is software, but it’s different type of software. Unlike Microsoft Word or Adobe Photoshop, git is not something you can double click an icon and open up the program. However, you can download a variety of tools that will allow you to open something like this — a graphical user interface (GUI) — that helps you visualize what you are doing with the software. This is important to distinguish because I’ve heard from some people that git is hard to figure out, only to learn later that they were simply using a complicated GUI. When I tell them that they can switch to a different GUI to visualize it differently, it blows their mind. Imagine it this way, you can use the internet in Firefox, Chrome, Safari, etc… it’s still all the same internet, but you are using a different GUI to interact with it. Git is similar. In fact, you can use git without any GUI using just the command line / terminal. I’ve heard git described as a way to save code. Say that to any beginner and they’ll give you the side eye like … “um… can’t we just Ctrl-S save our files?” Git is a version tool. It allows you to go back in time to find a file as it existed in a previous version, but it does much more than that. Unlike the view history tool in programs like Photoshop, Git doesn’t restrict you to a single timeline. You can create as many timelines as you need — each with its own history that you may travel through at any time. What’s more is that you can merge different histories from different timelines into a new file. “But, I don’t get it. Why would I ever need that? It sounds like it’s over complicating things for no reason. I don’t make that many mistakes that I would want to go back in time to fix.” You can and should use it in your personal projects, » Read More
Like to keep reading?
This article first appeared on medium.com. If you'd like to keep reading, follow the white rabbit.