What is Git?
Expert Advice from Tech Elevator Instructor, Walt Impellicceiri
Follow along with Tech Elevator Instructor, Walt Impellicceiri, as he outlines all the details on Git.
Editor’s Note: This article was originally published to Tech Elevator’s Learn to Code Resources Blog. You can visit the original post here.
Git is a version control system. A version control system enables you to version files and folders. Put another way, it maintains a history of changes to files.
This is valuable because in software development, our work often involves making incremental changes over time. We may also be collaborating with other developers on these changes. Keeping track of these changes enables us the flexibility to change direction before we’ve gone too far down one path.
When using Git, the set of files and folders that are being tracked are in what is called a repository. A change to the repository is not permanent until it is committed. Think of it like painting a wall. You may paint numerous sample colors before committing to painting the entire wall. Similarly with Git, you can make many small changes before you are satisfied and mark the set of changes with a commit.
There are two key benefits of using version control:
The ability to undo a change. Perhaps you made a mistake and you’d like to erase your changes or you’ve recognized that another developer made a mistake and you’d like to reverse their changes. This is done by making a change that is the reverse of previous.
Again, think of it like painting a wall. You may have started with a wall that was blue, then you painted it gray, but decided later that you did not like the gray color and preferred the blue color. You wouldn’t try to remove the gray color to uncover the blue color. Rather, you would repaint the wall blue.
The ability to see how you got to where you are. Let’s say you are collaborating with others on a project and you’re wondering why a certain change was made or why code was written in the way that you see it. Git can allow you to see the history of a file, including who has made changes, what the changes were, and even why they made them.
Think of this like a CarFax history report for a car that you are considering purchasing. The car may look great in its current state, but it’s still valuable to understand where that car has been and the work has been done to it in order to get it to its current state.
Collaborate using version control:
Software is often built by teams of people. Git can be used to foster collaboration amongst teams. Think of a shared Git repository like a shared photo album on your mobile device or a DropBox folder that you share with others. When photos or files are added or removed to the album or folder, other users automatically see those changes. That’s quite similar to how a shared Git repository works. The only caveat is that with a shared Git repository, the changes are not automatically pushed to the cloud and pulled onto others’ devices – this process is intentionally manual to ensure that folks that are working on the same files can choose when and how to merge their changes together.
One of the best examples of version control that I’ve seen is Wikipedia. It enables a collaborative approach to building up a repository of information. It’s quite similar to how a team would work on a software project using Git. Git and similar version control systems have even been used to track changes to legislation. Can you think of other examples where versioning things may be useful?
Ready to take the next step in your career transformation? Take the Tech Elevator Aptitude Test.