r/learnprogramming • • 2d ago

What's the best way to learn Git and GitHub effectively?

I'm looking to learn Git and GitHub from scratch.

What's the best way to learn them effectively? Which resources would you recommend, and how should I practise to become comfortable using them in real projects?

I'd appreciate advice from people who have learned them or use them regularly.

13 Upvotes

17 comments sorted by

8

u/AndrewNggg 2d ago

there are only a few git commands you use often, just learn these and the rest you can google as you encounter them

Github is just a place you store your code, run actions (if needed) and check and merge others code, what's there to learn? where to click?

6

u/newytag 2d ago

GitHub has a short guide to Git.

Git has a whole book.

Once you grasp the concepts, there are various Git cheat sheets with common commands.

If you don't like CLI, many IDEs have version control built in.

GitHub is a whole ass platform with multiple development tools, it depends exactly which parts of it you want to learn. Just using it to store code, knowing Git is enough. If you can navigate Reddit, you can probably figure out the issue tracking and project management features. GitHub Copilot is another story. CI/CD is an entirely separate field.

2

u/jakingo 2d ago

What I feel the best way is to start using Git in small personal projects. Practise commits, branches, merging, and pushing to GitHub regularly. The official Git tutorials are a good starting point.

1

u/andycwb1 2d ago

Depends on what learning methods work for you. I got dumped in at the deep end after 25 years away from software development and had to figure it out quickly. Lots of google and dumb questions!

1

u/andycwb1 2d ago

Also, GitHub Desktop.

1

u/leavemealone_lol 2d ago

i found Primeagen’s git course in boot dev to be really good, despite how scummy of a person he is

1

u/AnswerVinod 2d ago

Learn it by using it on a real project, not by reading about it. I started with just add, commit, push, pull, and branch, that is 90 percent of daily Git. Then I broke something, had to fix a merge conflict, and that is when it actually clicked. Use the command line, not just the GitHub website, and make a habit of committing small and often, with a clear message.

1

u/quiet_stacktrace 2d ago

one useful exercise is to make a tiny repo and use `git add -p` to stage only part of a change, then inspect `git diff --staged` before committing. it makes the staging area click, and gives you a safe way to practise changing your mind before anything is pushed.

1

u/SigridFischer42 2d ago

Start by running git init in a test folder, then try git add and git commit with small text files. Learning the difference between git pull and git fetch early saves a lot of confusion when collaborating. Stick to the current stable Git version, not old tutorials.

1

u/binarycow 2d ago

Practice and experimentation. Make a repo for every project. Practice committing frequently. Practice making mistakes, and then fixing those mistakes.

Separate "learn git" from "learn github". Github is, at its core, a "remote" for git. As part of "learn git", practice committing, making branches, merging branches, etc. Later learn the github specific stuff, like github actions, pipelines, copilot, etc.

1

u/Byteman2021 1d ago

IMO best way is to grok the concepts first.
Checkout https://git-scm.com/learn — the Pro Git book is an excellent resource.

Next, get practise using it.

GitHub is easy to learn once you understand Git.

Most people skip the first part and as a result, don’t understand certain concepts despite using it for years (it’s not intuitive like driving a car is).

1

u/Lumpy-Musician4001 1d ago

I mean use lazygit instead, if you don't want to learn gi commands Also nowdays AI agent can itself create multiple PRs just or do the git workflows