Branching, merging, rebasing, history surgery and collaboration workflows.
A teammate coming from an older version-control system is afraid to create branches because "it copies the whole project". What is a branch in Git, and why is creating one almost free?
You are on main and need to start work on a ticket called
"add-search". Which commands create a branch, switch to it, and do both
at once? What is the difference between git switch and
git checkout here?
Git messages keep mentioning HEAD. In plain words, what is HEAD,
what does it usually point to, and what changes about it when you
switch branches?
You branch fix-typo off main, make two commits, and nobody touches
main meanwhile. When you run git merge fix-typo on main, Git
says "Fast-forward". What did it actually do?
Your branch add-export was merged yesterday. You run
git branch -d add-export and it works, but on another branch
try-cache the same command refuses. What is the difference between
-d and -D, and why did Git refuse?
On your first team, a senior asks you not to commit directly to main
but to use a feature branch for each task. What problems does that
avoid, both for you and for the rest of the team?