Git's Use Cases
Feedback welcome: hello@simplegitcourse.com
Chapter 1: Introduction
If you're completely or at least relatively new to programming, you will eventually need to learn Git basics in order to work with teams publicly or privately, publish projects, receive feedback on your code or at the very minimum, create a versioned backup of your code.
In this chapter, we’ll be covering:
- Core Git concepts and example use cases.
- What a CLI is and basic use.
- Installation and configuration.
What is Git?
At its core, Git is a tool that allows you to create snapshots of your code so that you can collaborate and ship code easily.
Officially, Git is what is called a "Version Control System" or VCS. Many different VCSs have existed over many decades and at the moment, Git is one of the vastly most popular ones.
Now, let's talk about how Git is actually used in reality, with examples - in other words, the “use cases” of Git.
Use Case 1: Capturing Changes
If you've played a video game or two in your life, you probably can understand the concept of a save point. Before a key moment in the game, you will probably want to save your progress. This isn't any random point in the game though. Most likely, you save your work after you've accomplished something or at a place where you can load the game later.
Capturing changes using Git works the same way. We can save a "snapshot" of the coding project we are working on when we feel like it is appropriate to do so.
In Git, this “snapshot” is what’s known as a Commit. A Git Commit will contain a list of changes we’ve made at a given point in time as well as the author, a message, date and time.
The use case here is that Commits can be shared, reviewed, and used for collaboration as complex software projects are built, as you will see in this course.
Use Case 2: Organizing Changes
Writing code is like writing a book. This is done with one or more colleagues that may also contribute to the book. Writers may edit each others’ work. When we write a series of pages of a book, sometimes we want to organize a series of pages and then ask others to review them.
A series of pages of a book, experimental or not, is akin to how software engineers use Git. We create a series of Commits and sometimes that series can represent a very specific feature we are writing.
So grouping a series of Commits in Git is what’s known as a Branch. A Branch in Git simply has a name and a series of Commits associated with it. Branches can also be merged with one another, which we’ll cover in this course.
When we write larger and more complex portions of code and work with more and more team members, Branches help us organize our changes and collaborate efficiently.
Use Case 3: Collaboration
External code review tools can leverage Git to help engineering teams move efficiently and effectively. These tools, one of which we’ll cover in this course, GitHub.com, help engineers review and collaborate.
Collaboration typically involves a code review and critique process. An engineer will create a branch of code that others can comment on. Maybe the code can be written more clearly or maybe a bug was found. All of these can be pointed out and discussed using tools that GitHub and other collaboration tools offer.
In this course, we’ll cover how this works hands on using GitHub’s Pull Request feature.
There are many more use cases that Git covers but the ones above comprise the vast majority of them. The most effective way to learn is to read on, understand the concepts involved and dive into real examples. Let’s continue!
Next up: Installation & Configuration