Git

Git is the most popular version control system in the world. But this definition may not make sense to all of you. To better understand it, you have to know the following 3 primary things:

  1. What does it do?
  2. Why is it so useful?
  3. Why do people love it?

What does Git do?

Git workflow

Git helps us to manage our project files. And a project could be anything such as website design, development, mobile app development, and anything that is related to programming. But what does Git do that makes it easier to manage our project files?

Well, three main aspects help us manage our project files more easily.

  1. History
  2. Collaboration
  3. Feature branches

Git history:

Git history, Git history icon

It simply means that Git keeps track of the changes we make to our files. It could be adding/removing new lines/code, images, files, anything & everything in between that refers to the word “Change.”

For example, you made some changes to your CSS file last April. And for some reason, you need the old CSS. Git’s history can help you in this regard. To do that, you have to look for the previous “commit” and you will find all the changes that you made (including old and new code).

See the screenshots below for more clarifications.

Git commits
Git commits
Git history
Git history

In the above history, the reddish background lines were deleted and new greenish lines are added. The lines in the white background have no changes.

This is what the Git history is.

Without a version control system, it’s not possible to keep track of the changes. Learn more about using Git.

Nothing is ever lost, and nothing is ever final in the version control system.

Collaboration:

Git collaboration infographic

If you create something on a computer with a team or group of people, there is a common concern to override each one’s progress. That would be a cause of conflict.

However, Git makes this teamwork or collaboration easier than ever. It takes care of merging, conflict & accidentally deleting each other’s progress.

Collaboration allows you to become more productive because you don’t have to wait or sit down for someone else’s progress. After you finish your task, you can push your progress to the repo. And this applies to everyone working on your team. See how you can install Git on your computer.

In a nutshell, when everyone finishes their work and when it comes to merging everyone’s code, Git will take care of merging any conflicts.

Git feature branches:

Git branches

When you initiate Git (git init) or create a project or repository, it automatically creates a branch called “master.” But you’re just not limited to creating or using only one branch (master). You can create more branches when needed.

For example, you need to edit a website’s header & sidebar and you need to assign these two tasks to two different team members. In this regard, you can create two different feature branches named “header-changes & footer-changes.” Now the two separate persons can work for these two branches independently.

This way one programmer does not hostage another developer’s work. You can learn more about Git branches in this post.

And each of the developers can merge their code when they finish and Git will take care of the conflict as I discussed in the last section.

To learn more about feature branch workflow, see another article on Atlassian (Bitbucket). If you want to use GitHub as the hosting service, see how to create a repository on GitHub.

Learn more about Git

Conclusion

Now you have a basic understanding of Git and you know what it is used for. If you’re just getting started, it may look intimidating. But it’s not as hard as it seems.

Sometimes beginners mess up it with GitHub. If this is you, see their differences.

To become familiar with it, you have to make your hands dirty. And there is no other way around it. Also, be sure to check the most commonly used git commands. You’ll also find a downloadable cheat sheet on that post.