Git Flashcards

1
Q

Difference between checkout and switch

A

switch is created for the single purpose of changing branches, and when you do that, you do want to be at the HEAD of that branch. checkout is a more general operation which brings your working copy in line with any given state in the history (= commit). Since any branch name is an alias for the HEAD commit of that branch, checking out a branch is technically no different than checking out any other commit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly