Whilst trying to make some changes to a GitHub project, using an Ubuntu box, I hit an interesting issue with git switch - namely that it doesn't work
So I'm running Ubuntu 18.04.6 LTS: -
lsb_release -a
No LSB modules are available.
Distributor ID:Ubuntu
Description:Ubuntu 18.04.6 LTS
Release:18.04
Codename:bionic
Distributor ID:Ubuntu
Description:Ubuntu 18.04.6 LTS
Release:18.04
Codename:bionic
and had created a new branch: -
git branch
test_doc_update
* develop
* develop
and then tried to switch to it: -
git switch test_doc_update
but instead got: -
git: 'switch' is not a git command. See 'git --help'.
I checked the version of Git: -
git --version
git version 2.17.1
and even tried upgrading it: -
apt-get update && apt-get upgrade -y git
...
The following packages will be upgraded:
git git-man
2 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
git git-man
2 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
...
but to no avail: -
git --version
git version 2.17.1
Instead, as per this Git: ‘switch’ is not a git command. See ‘git –help’ I used this instead: -
git checkout test_doc_update
Switched to branch 'test_doc_update'
git branch
* test_doc_update
develop
develop
Sorted !
For the record, I have a more up-to-date version of git on the Mac, via Homebrew
ls -al `which git`
lrwxr-xr-x 1 hayd admin 28 19 Apr 08:59 /usr/local/bin/git -> ../Cellar/git/2.36.0/bin/git
git --version
git version 2.36.0
with which git switch DOES work