• 12 Posts
  • 353 Comments
Joined 3 years ago
cake
Cake day: June 9th, 2023

help-circle












  • That picture you included is kinda weird and misleading IMO.

    First thing: Ignore the “central repository”. There is none. git works entirely locally (this confuses the hell out of people who grew up with CVS/SVN, for some reason). You CAN push and pull to other people’s computers, if you want, or your own other computer; all Github or whatever is is a “someone else’s computer” in the cloud that you can push to. But you also don’t need a remote repository at all. Most of ours don’t have one.

    Seconding https://learngitbranching.js.org/. It’s quite nice.

    Some stuff you should know:

    • A commit is a snapshot of everything in the project (that was added to git at the time).
    • A branch is basically just a movable tag pointing to the latest commit, with which you can get to previous commits by walking the chain backwards; when you make a new commit, you move the branch to point to it.
    • You can make alternate timelines by going back to a previous commit (without moving your branch pointer), making a new branch pointer (and switching to it), and editing/committing/etc. That’s why they’re called branches.
    • There’s an undo history for where your branch has been, git reflog. Can save your butt if a rebase or whatever goes sideways and you get screwed up.
    • All your history is in the .git folder in your project folder. Everything. If you back that up you’ve got the whole history of the project.

    – Frost