Hacker News new | past | comments | ask | show | jobs | submit login

Git checkout branch means change the entire working tree to the reflect the state of the branch and git checkout file, checkout the state of that file in HEAD. Both commands to the same thing, change the state of your working tree to reflect a point checked into version control.

It sounds like you are unaware of

  git switch branch
and

  git switch -c new-branch



Just a tip: when teaching people, the readable alias is easier to remember and understand, i.e.

    git switch --create new-branch


Thank you. It seems silly but my first parse was "-c(heckout)" but that comes from not using "switch" yet; I need to rewire my brain from "checkout".


It was a good example: it was obvious by the name of the branch and he/she was teaching the real word use case




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: