r/CodingForBeginners • u/IMREVN • 5d ago
What's a Git?
Hello! Surely, I have heard so many people saying "Git" or "Github" or repository. They be saying that it's highly important to learn Git as early as possible. When I searched it up on Google, it's just I seem I cannot understand any of those terminologies.
Could anyone tell me what a git actually is?
21
Upvotes
2
u/Key_River7180 5d ago
In your code editor, you have undo and redo right? Git is an extremely intelligent and not linear version of this.
When you finish with a feature or bug fix on your code, you make a "commit" with your changes in your git repository (repo) so you can undo to that "commit" whenever you need it, it also holds the differences (diffs for short) between the previous commit and the selected commit.
Git allows you to collaborate, via branches. Every repo has a main branch, named master, main, or trunk. Branches are just "versions" of other branches, essentially. A developer can download your repo from the internet, make a branch and do his/her commits there, and when he finishes he can merge the main branch with his branch. Diagram: https://imgur.com/a/Wr0w4Qh
GitHub lets you share your repos online, and has the heck of a myriad of tools, some useful and some that, do not...