What is Git and why use it?

Git is a platform for/with “Version Control”.I explain the definition with the simplest words/examples I can.

In the past, when you wrote code, you saved it on the local computer and it’s good, but everyone’s been told that over time you’re making a new “backup” folder that has a certain software level, that you don’t lose it. if something goes wrong.After a few months you have X folder, hardly knows where the last version is or what you did last.It gets worse when you put a certain stand on a USB stick. Then you have to search sticks and PCs for the latest version.And what about sharing code snippets to reassemble them afterwards? All this is then pure hell.

The solution?Version Control.

Version Control/Git allows you to comment on and upload any code change, among other things.If something goes wrong, you can simply sync an earlier version again (or choose another “branch”) and move on. With a single command, you can synchronize the latest version with the computer, which really makes life easier.

“Branches” in other hands are just that: “branches” in German.You can move a project to another “branch” at some point, either to try something or to do an abstraction of the program without breaking the main branch (pronounced “master”). If this goes well, you can melt it back into the “master” or just carry on like this.

(Image from Twitter.

Shows “Branches”)

In the end, all changes have been nicely listed and commented on since the very beginning and can jump over branches/versions and/or continue.

(File on GitHub with changes.

Red old, green new)

What’s more, as a team you can work on the same project and it only syncs exactly what was changed – even in the same file.Even if two people work on the same line and synchronize this, Git “asks” which change should remain and which should not. Imagine having a network drive and all the work there (instead of Git)?You open a file, your colleague does the same. On it you rewrite 127 lines, your colleague only 2. You save, but only after that. Upps, 127 are gone, 2 are only there… After that, the PC is thrown to the window.

I hope I could shine a bit of light on Git, how it works and why you should use it.

Leave a Reply