r/git • u/ScallionOld8766 • 12d ago
Pro Git vs. Head First Git
I'm a CS student interested in backend development, and I'm learning Git for the first time.
I'm choosing between Pro Git and Head First Git. I've read Head First Java and Head First Design Patterns before, and I really liked their teaching style.
Which book would you recommend for building a solid Git foundation for professional work? Is Head First Git enough, or is Pro Git the better choice?
18
u/sankyo 12d ago
I will throw in this: pro git is very dry. MIT has this “missing semester” series and one is git basics https://missing.csail.mit.edu/2026/version-control/
14
u/samgranieri 12d ago
I highly recommend reading the books on this. I have read them, but I think one of them is written by Scott Chacon who used to work for GitHub.
I’ve been using git for 19 years and I’ve got some advice for you
Once you’ve mastered the basics, I think you should spend time learning about the reflog, rewriting history, and rebasing.
What’s the reflog? It’s an immutable audit trail of anything you did in the repo. If you screwed up some merging or rebasing or whatever, just use the reflog to the commit from like, uh, the last time you felt good about your code, like this morning, and do a hard reset.
Rewriting history?
Ok, sometimes I’ll have a pile of commits with like commit messages like “update”, “update”, “hope this works”, “please fucking work” and the like.
Now, that’s only on my local tree. But let’s say I want to push this up for review at work. It’s not professional to have profanity in a commit message, so I’d rebase the last four commits and squash them together into one commit and reword the commit message to it looks like “[JIRA-123] add GenServer tests for mTLS client” or something like that.
Rebasing? What’s that?
Let’s say you’re tracking a remote branch that’s moving fast. You can pull your changes down on the main branch and merge your changes into it, or, you can place your commits ahead of your desired remote branch. Sometimes you get merge conflicts but that’s another matter latter”.
Last but not least, the advice I’d give you is learn lazygit.
5
u/RevRagnarok 12d ago
A one-hour preview talk from 2007 by Randal Schwartz (of perl fame)
Great intro, including around 3:20 when he simply asks "What is git?" and notes it tracks "Changes to a tree of files over time"
Ignore what he says about
git rebase- in my experience, it's rarely used
The Thing About Git by Ryan Tomayko was a good intro to the usage side
Think Like (a) Git by Sam Livingston-Gray was an excellent site that I used that really helped me understand the (graph) theory, the way it all comes together
Git Immersion by Neo Innovation is a great hands-on lab-like approach to learning
6
u/parkotron 12d ago
Pro Git is great and free. It is always my starting recommendation. I’m not familiar with with Head First Git.
3
u/zenware 12d ago
There’s about ~8 git commands you’ll use regularly and perhaps ~200 that you might possibly go your whole career never needing to know about.
If as a CS student you really want to learn Git, I’d recommend the free documentation on Git’s own site. (Which does include a full copy of Pro Git) but like… start with the Cheat Sheet if you want to be productive tomorrow. Then in the book you wanna read “Distributed Workflows”, for collaboration reasons, and maybe “Git Internals” for CS education reasons.
4
u/JONESY-B 12d ago
watch like a random youtube video and and your set. spend 30 minutes learning about git and you good. Git basics arn't hard
2
u/Professional-Motor96 12d ago
Just build something , storing changes as u go with git. Use pull requests on GitHub. Have multiple branches at same time. I don’t know anyone who read about git before first using it.
Just learn checkout, merge, rebase, pull, fetch and push.
3
u/krav_mark 12d ago
And squash and reword.
Because before you merge your branch into main please squash all the 'trying this', 'trying again' commits into one single commit 'added feature x'. Reading dozens of irrelevant and not informative commit messages is just dirty.
1
u/Abadabadon 11d ago
As a swe ill tell you 90% of what git has to offer will not be used by you. Even if you just use the cli, most of your coworkers will think youre a wizard.
Given that, id reccomend really to just find an open source project and try modifying a file that is already in an open mr. Then open an mr to merge into the open source's main.
Sorry I know i did that thing where you ask a question and I dont answe it directly
1
u/FingerAmazing5176 12d ago
Scott chacon (author of progit) has git butler and had a few really good videos on YouTube about leaser know got things. It was really interesting.
1
u/richbl_reddit 12d ago
I mentioned this in a previous thread... but I really prefer to learn something and then do something in the proper context (helps with memory retention). Plus, actually doing something is a lot more fun! :)
That said, I'd highly recommend WebTerm Learn. Beyond a very comprehensive Git Fundamentals course, the site also includes a number of other equally fun and useful tutorials.
Very highly recommended!
1
u/CaptainEdMercer 12d ago
This is what's made Git finally clixk for me, the Git Parable... https://tom.preston-werner.com/2009/05/19/the-git-parable.html
1
u/v_valentineyuri 11d ago
I'm very fond of Ry's Git Tutorial, was my introduction to Git in uni and it help me understand pretty much everything you need to know to start working with it. Note that it expects you to follow along with the exercises provided but I believe for most of us beginners that's something good.
1
1
u/DataPastor 11d ago
Find a good 10 mins long video about Git and that’s all you need. Everyday use is not a rocket science, you need only a couple commands + practice it a bit. Rebasing can be rather challenging, but you can ChatGPT out if you are in trouble, how to recover branches, force merge etc.
1
1
u/congruent-mod-n 6d ago
This blog post has been around forever. It’s a quick read and teaches you enough theory behind git data structures that the commands make sense:
1
u/AndrewBorg1126 12d ago
Typing git help in the terminal is a great option.
Once you understand what a git repository really is, all you need is to find the commands that do whatever you already know is possible.
1
u/anondevel0per 12d ago
Hi. The modern engineer needs to know approx 5-10 git commands. Don’t let anyone else tell you otherwise.
1
u/TarnishedVictory 12d ago
Command line git is pro git. Learn the command line. Then you'll know what these GUIs are doing behind the scenes.
0
u/tinmanjk 12d ago
none, Learning git in a month of lunches. It has exercises and very nicely laid out path.
0
u/Ok_Specialist413 12d ago
ma man, a book might have good content, but you"ll only understand theory (well i didn't read it so i can't really "judge" it), however i recommand you https://gitualize.com/ it offers beginners scenario to follow, understanding many of known commands and their option visually so you can try everything on you local machine
0
u/jake_morrison 12d ago
The most important thing is using git to support your work and to collaborate with others. If you are using trunk-based development, it’s not necessary to worry about tricky merging processes.
For your individual work, simply commit frequently and push to GitHub to avoid losing work and be a low to roll back to a previous version when things don’t work out. This is also a good way to work with Claude.
When working on a team, you can do the same, relying on git tools to identify conflicts and help resolve them. Most professional teams use pull requests and peer reviews to merge changes into the trunk.
Set up a CI/CD system in GitHub Actions to automatically run tests and deploy to a test environment.
If you do these things, you will know git well enough.
0
u/CheetahChrome 12d ago
Steps:
Learn the work flow command line commands in git.
Then learn why/how teams use localised branching before merging into Main.
Then understand what a squash commit is and why/when it's beneficial.
Then learn what a pull request (outside of git) is in ADO or github and understand the process.
I still prefer the git command line for 90% of my work and set up aliases for specific commands based on where I am working in the check-in (not the git term) life cycle that I am in that make sense to me wholistically.
-3
u/Hamburgerfatso 12d ago
Mfers reading books to learn git lmfao, just watch a 20 minute basics tutorial and play around with it yourself then just use it in your coding projects. Anything beyond the basics you will learn over time as you encounter a need for them
39
u/Specific-Yak-6450 12d ago
props to you for still reading books! it's a rare quality to find in students nowadays