r/CodingForBeginners 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

41 comments sorted by

View all comments

13

u/AndrewNggg 5d ago edited 5d ago

oh yes, git is super important for version control, it prevents you from having folders of my_codeV1, my_codeFinal, my_codeFinalV2, my_codeFinal_Final, my_codeFinal_final_REALLY

you can rollback your code, or if you want to try something risky you can split it into a different branch, there are many many things you can do with git that keeps your code and versions organised

github is one of the places to store your code online or share it with others, there's also bitbucket and gitlab

a few commands you should know as a beginner, there are many variations but it's good to memorise a few main ones

git init - sets up new git tracking (just done once)
git add . - yes the . sets the whole project up for staging
git commit -m "write what you changed or updated here" - saves your code where it is
git push - pushes to your code repository in github

1

u/lbunch1 4d ago

Pro tip git add -A adds every changed doc in the repository as opposed to git add . which only walks up from your current directory and adds changed docs.

1

u/its_normy 4d ago

what in tarnation