3 ms·
Maybe the one thing that made it click for me was realizing that a branch is merely a label to a git commit hash. There can be local and remote ones and the loc
by karmakaze 4y ago
Maybe the one thing that made it click for me was realizing that a branch is merely a label to a git commit hash. There can be local and remote ones and the local is aware of the remote (e.g. git pull). Checking out a branch makes it current, with filesystem matching the branch head's git fileset state. New commits get added and the branch label moved to the new head.
That and a git tree view GUI or "git log --oneline --graph" and "git reflog" to undo stuff. Also, you're better off committing temp stuff on the current local branch with message "WIP" than using "git stash".
- karmakaze 4y agoHow I really learned git well though was looking in the .git/ directory. "ls .git/refs/heads" shows a bunch of files with names of local branches. And "cat .git/refs/heads/my-local-branch" shows a git commit hash. You can learn a lot about git this way, and it's first-hand knowledge that's easier to recall than reading about it somewhere.