"git branch --track" vs "git checkout --track" "git branch --track" vs "git checkout --track" git git

"git branch --track" vs "git checkout --track"


Internally git-branch is called and then the new branch is checked out. From the docs.

If -b is given, a new branch is created as if git-branch were called and then checked out; in this case you can use the --track or --no-track options, which will be passed to git branch. As a convenience, --track without -b implies branch creation; see the description of --track below.


If I'm not mistaken, git checkout ... will actually create the branch AND switch your working copy to that branch, while git branch ... will just create the branch and leave your working copy alone.


According to the documentation for git checkout, there should be no difference.

-b Create a new branch named <new_branch> and start it at <start_point>; see git-branch(1) for details.