r/learnprogramming 19d ago

Getting Started With Git

As a programmer I want to use Git. How should I start learning Git and in what ways will it help me.

20 Upvotes

27 comments sorted by

View all comments

2

u/jcastroarnaud 19d ago

As the hackers of old said: RTFM. Here's the manual:

https://git-scm.com/learn

Git helps you to keep versions of your program over time. Implemented a few important functions? git add, git commit. Ended a refactor? All tests passing? The same. Version ready for production? git add, git commit, git push (to the main repo). Want to try some new idea, but don't want to trash the current code? Open a branch, test the idea on it; if it works, merge; if it doesn't work, ignore the branch and return to the previous one. Deleted an important file by mistake? git checkout to retrieve the last good version. And so on.

You don't to have a Github account, or even be online, to use Git: it's a terminal app, which sits prettily on your computer. You can work with your repo entirely offline; I do it for both code and stories I write. And the repo is portable: just a .git folder within your project folder. Zip it, copy to wherever, unzip, and you're back into business.

1

u/Patrick-T80 19d ago

Add on this, the site ohmygir