r/git • • 25d ago

Should I be learning Git

So i stated college like 3 months ago and everyone is telling me donsomething or the other but i don't know where to start ...I know how to use github but not git I stated by reading the pro git book it's fun reading it but is git really that usefull or should I be learning something else

113 Upvotes

161 comments sorted by

View all comments

1

u/Kyraimion 25d ago

I remember starting uni and suddenly there were 20 new things I needed to learn, and it was just overwhelming and sapped my motivation. So depending on what you are studying (probably CS?), you will want to learn git eventually, but it needn't be the first thing and certainly not right now. I would not, for example, prioritise it over learning a programming language. Also don't feel like you have to study git like it's French, it's perfectly feasible to start with just one or two useful things and then add new concepts as you need them. E.g. you could just look at it as "quicksave for my code", you know, like in a computer game, you press F5 so you can reload when you make a mistake. Except it's just git add . and git commit -m "quicksave", which creates a new save point ("commit") on your computer that you can come back to later. You needn't even worry about "reloading" until you need it.

Here's slightly more detail to get you started:

You need to run this once on your computer so git knows who created the save points, you can choose anything here, but using your real email is a good idea if you later want to upload your code to a "forge" like github or gitlab

  • git config --global user.name "Your Name"
  • git config --global user.email "you@example.com"

You need to run this once per project in the project directory to set up git for the project:

  • git init

You run these once in a while, e.g. after you finish a feature or before you want to make a big change to save your work:

  • git add . prepares all the files in the project for saving. Later you may want to pick and choose, but for now don't worry about it
  • git commit -m "quicksave" creates the commit (save point) and names it "quicksave". You can also pick any message instead of "quicksave" here to find it later. Ideally you describe what changed, like "Added login page", but that's no law.

That's it. You're now using git. You may want to learn about gitignore, git log and git checkout next, but that can come later.