from a message like your branch is ahead of 'origin/main' by 1 commit
key points
git diff compares changes in the "working directory" before adding them to the "staging area"
git checkout create and switch between branches
HEAD refers to the most recent commit in the "working directory"
origin refers to the most recent commit in the "remote repository"
if your HEAD is before origin, then you need to pull
if your origin is before your HEAD, then you need to push
narrative
when we pull from remote, the HEAD is sync with origin
practically, HEAD is the local tip you are editing, while the origin refers to the last common point between the local and the remote
when adding local commits, your HEAD advances with respect to the origin
to sync back again HEAD and origin, then push your commits
also
if the remote has new commits, git status tels you that your branch is behind origin/main by the number of commits, suggesting you to pull to update local branch
NOTE: evaluate to move the explore history episode to appendix
from a message like
your branch is ahead of 'origin/main' by 1 commit
key points
git diff
compares changes in the "working directory" before adding them to the "staging area"git checkout
create and switch between branchesHEAD
refers to the most recent commit in the "working directory"origin
refers to the most recent commit in the "remote repository"HEAD
is beforeorigin
, then you need to pullorigin
is before yourHEAD
, then you need to pushnarrative
also
NOTE: evaluate to move the explore history episode to appendixreference: