Categories
Git

What exactly are Git Commands?

Git cammands do one of three things:

  • Add files and directories to the staging area.

  • Build commits (a new node in the graph).

  • Move labels from one node to another.

    • E.g., git checkout feature.
    • When you type “git commit”, you’re just moving the label for that branch to the node Git created when you staged content (HEAD now point to INDEX).

Git refers to a label as a reference. References make commits reachable (like address pointers). Local branch references move when you perform commands like “git commit”, “git merge”, “git rebase”, “git reset”. Remote branch references move when you perform commands like “git push”. Think of a branch as a time-line (alternate universes).

Leave a Reply