1

I'm confused to which one actually creates a branch based on the current branch?

We can even add git branch <branchname> on top of them, aren't they all the same?

Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74
Harun
  • 29
  • 5
  • 1
    You can check this [https://stackoverflow.com/questions/57265785/whats-the-difference-between-git-switch-and-git-checkout-branch](https://stackoverflow.com/questions/57265785/whats-the-difference-between-git-switch-and-git-checkout-branch) – Sublan Mustafa Apr 04 '22 at 10:38
  • Different spelling, same results, yes. (However, `git branch newname` has different results: it does not switch *to* the new branch as part of the creation process, while `git checkout -b` or `git switch -c` does.) – torek Apr 04 '22 at 19:25

1 Answers1

1

It's formally the same thing in terms of results, but it is a newly introduced verb which less responsibility as checkout.

Read this article for further information.

Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74