Learning more advanced git is hard. Reading tutorials, alone and without a concrete problem to solve, has been slow and confusing for me. But also when I have a situation where changes are more messy than I know how to deal with in git, that is not the best time either to get lost in complex docs. It has often seemed best to just focus on the code for now, and find a workaround within what I already know how to do. This means I get very good at creative workarounds, and patiently starting over, instead of actually using git for version control of my code.
But I’ve had some success lately with learning new ways to use git — and also noticing what has been in place for the leveling up to happen:
- have a situation with messy branches or confused commits
- understand that it can probably be handled more elegantly than I know about
- ask someone else how they would go move forward
This is fabulous. 🎉 It’s a shortcut to pick up a new command, perhaps they even sit next to me while I use it. And instead of just reading about some potential scenario, I get to apply it to a practical use case right away to solve a specific problem I have. Later I can go read more.
git add -p
- Super useful command to let me go through parts of changes in each file.
- I can choose which bits to stage now — and which to leave unstaged.
Learning this also came with a better understanding of staging. This has previously just been a step I go though, without it meaning much. And wow, I can now stop worrying about making multiple unrelated changes — because I know how to create clean commits out of it all.
Note to self — Even though I have a workaround, ask people for quick tips more often. 👍