How does Git track changes?

How does Git track changes?

ยท

2 min read

Learn the basics of how Git does the work of version control but also see some terminology we will look at in the future.

Prerequisites: You have a basic understanding of Git hence you've created a repository with Git and made a commit too.

For every commit made in a working directory, a save or snapshot of your entire project is taken and that is all the states of your current files and folders in that directory.

It's like a phone screenshot. When you take a screenshot, everything that was currently on the screen at the time is captured and saved as an image.

This is exactly how git works hence the term version control. You as a user can have multiple snapshots of your working directory in different states. And to make it even better, you can have different commit messages for different files in the same directory. These multiple snapshots of your directory are also called versions.

This will help you to know where you stopped in a certain file, and the edits or changes you made, it will also help when you want to go back to the previous version of a file state.

These version control capabilities are amazing in the long term and you'll see it too.

There are a tonne of things and a lot of capabilities of Git that we will dig into step by step.

This was it for this article but before we conclude, I would like to show you some of the terminologies that will be used in the next articles that I will explain in detail but to have in mind:

  • remote

  • clone

  • fork

  • upstream

  • push

  • fetch

  • log etc

And many other terms but don't worry I'm going to explain all these terms in detail as we go together in the series.

Conclusion

And that's it. Hope this simple blog helped you to have a basic understanding of how Git does its work. Its underlying functionality of how exactly it does it includes a diffing algorithm which would be ahead of this scope for someone new to the technology.

Thanks for Reading.

ย