Update the git

Scenario: with Git version 2.28 or greater, you can change the defaultBranch using init.defaultBranch. Therefore, the current version of Git installed on the local computer is too old and needs to be updated to version 2.28 or later.

To view

~ brew info git git: stable 2.29.2, HEAD Distributed Revision Control system https://git-scm.com...Copy the code

update

brew upgrade git
Copy the code

The update process is as follows

brew upgrade git
Updating Homebrew...
Warning: You are using macOS 11.1.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
pre-release version.

==> Upgrading 1 outdated package:
git 2.23.0_1 -> 2.29.2
==> Upgrading git 2.23.0_1 -> 2.29.2
==> Downloading https://ftp.gnu.org/gnu/gettext/gettext-0.21.tar.xz
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/fbd8967fd8256b2e1856b74e8ff0f3d8371cb652c5768e47649613a69d4dc841--gettext-0.21.tar.xz
==> Downloading https://ftp.pcre.org/pub/pcre/pcre2-10.35.tar.bz2
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/48997c77a7dae2fb85d52234e92e9032019609e091e23d72529d1e552978a260--pcre2-10.35.tar.bz2
==> Downloading https://mirrors.edge.kernel.org/pub/software/scm/git/git-htmldocs-2.29.2.tar.xz
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/121a858acf277913dc50e88327bdab2d23472eaef1be3d6d578e0d2af1581398--git-htmldocs-2.29.2.tar.xz
==> Downloading https://mirrors.edge.kernel.org/pub/software/scm/git/git-manpages-2.29.2.tar.xz
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/943040db2aac5a66a4faae1cb07ea9ea9a98ee2c2928750d2f86277a1b64099b--git-manpages-2.29.2.tar.xz
==> Downloading https://cpan.metacpan.org/authors/id/R/RJ/RJBS/Net-SMTP-SSL-1.04.tar.gz
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/0726c68dac390b617cefcc880f076b50795463c1fba286d46a53082ebed2bc9d--Net-SMTP-SSL-1.04.tar.gz
==> Downloading https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.29.2.tar.xz
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/6b8b369d6a5b8c38330cef909d4a876403d2badc5ab22b2118a562520da30d7c--git-2.29.2.tar.xz
==> Installing dependencies for git: gettext and pcre2
==> Installing git dependency: gettext
==> ./configure --prefix=/usr/local/Cellar/gettext/0.21 --with-included-gettext gl_cv_func_ftello_works=yes --with-included-glib --with-included-libcroco --with-included-libunistring --with-emacs --wi
==> make
==> make install
🍺  /usr/local/Cellar/gettext/0.21: 1,953 files, 19.8MB, built in 9 minutes 52 seconds
==> Installing git dependency: pcre2
==> ./configure --prefix=/usr/local/Cellar/pcre2/10.35 --enable-pcre2-16 --enable-pcre2-32 --enable-pcre2grep-libz --enable-pcre2grep-libbz2 --enable-jit
==> make
==> make install
🍺  /usr/local/Cellar/pcre2/10.35: 230 files, 6.1MB, built in 53 seconds
==> Installing git
==> make install prefix=/usr/local/Cellar/git/2.29.2 sysconfdir=/usr/local/etc CC=clang CFLAGS= LDFLAGS= NO_TCLTK=1 NO_OPENSSL=1 APPLE_COMMON_CRYPTO=1
==> make CC=clang CFLAGS= LDFLAGS=
==> make clean
==> make
==> make test
==> make CC=clang CFLAGS= LDFLAGS=
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Summary
🍺  /usr/local/Cellar/git/2.29.2: 1,479 files, 39.7MB, built in 1 minute 10 seconds
Removing: /usr/local/Cellar/git/2.23.0_1... (1,543 files, 44.9MB)
==> Upgrading 2 dependents:
libidn2 2.2.0_1 -> 2.3.0, wget 1.20.3_1 -> 1.20.3_2
==> Upgrading libidn2 2.2.0_1 -> 2.3.0
==> Downloading https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
######################################################################## 100.0%
==> Downloading https://ftp.gnu.org/gnu/libidn/libidn2-2.3.0.tar.gz
######################################################################## 100.0%
==> Installing dependencies for libidn2: pkg-config
==> Installing libidn2 dependency: pkg-config
==> ./configure --prefix=/usr/local/Cellar/pkg-config/0.29.2_3 --disable-host-tool --with-internal-glib --with-pc-path=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/local
==> make
==> make install
🍺  /usr/local/Cellar/pkg-config/0.29.2_3: 11 files, 656.6KB, built in 1 minute 37 seconds
==> Installing libidn2
==> ./configure --prefix=/usr/local/Cellar/libidn2/2.3.0 --with-libintl-prefix=/usr/local/opt/gettext --with-packager=Homebrew
==> make install
🍺  /usr/local/Cellar/libidn2/2.3.0: 72 files, 808.2KB, built in 56 seconds
Removing: /usr/local/Cellar/libidn2/2.2.0_1... (70 files, 700.9KB)
==> Upgrading wget 1.20.3_1 -> 1.20.3_2
==> Downloading https://www.openssl.org/source/openssl-1.1.1h.tar.gz
######################################################################## 100.0%
==> Downloading https://ftp.gnu.org/gnu/wget/wget-1.20.3.tar.gz
######################################################################## 100.0%
==> Installing dependencies for wget: [email protected]
==> Installing wget dependency: [email protected]
==> perl ./Configure --prefix=/usr/local/Cellar/[email protected]/1.1.1h --openssldir=/usr/local/etc/[email protected] no-ssl3 no-ssl3-method no-zlib darwin64-x86_64-cc enable-ec_nistp_64_gcc_128
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/[email protected]/1.1.1h/share/man MANSUFFIX=ssl
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/[email protected]/certs

and run
  /usr/local/opt/[email protected]/bin/c_rehash

[email protected] is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/ usr/local/opt/[email protected] / bin:$PATH"'>> ~/. ZSHRC For compilers to find [email protected] you may need to set: Export LDFLAGS=" -l /usr/local/opt/[email protected]/lib" export CPPFLAGS=" -i /usr/local/opt/[email protected]/include" For pkg-config To find [email protected] you may need to set: Export PKG_CONFIG_PATH = "/ usr/local/opt/[email protected] / lib/pkgconfig" = = > the Summary 🍺 / usr/local/Cellar/[email protected]/1.1.1 h: 8060 files, 18.4 MB, Built in 8 minutes 50 seconds = = > Installing wget = = > the. / configure -- prefix = / usr/local/Cellar/wget 1.20.3 _2 - sysconfdir = / usr/local/etc - with - SSL = openssl - with libssl -- prefix = / usr/local/opt/[email protected] Gl_cv_func_ftello_works = yes, disable - pcre, dis = = > make install 🍺 / usr/local/Cellar/wget 1.20.3 _2: 49 files, 4.0 MB, built in 2 minutes 17 seconds o: / usr/local/Cellar/wget 1.20.3 _1... (50 files, 4.0MB) ==> Checking for dependents of Upgraded-formulae... ==> No broken dependents found! ==> Caveats ==> git The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula. Bash completion has been installed to: /usr/local/etc/bash_completion.d zsh completions and functions have been installed to: /usr/local/share/zsh/site-functions Emacs Lisp files have been installed to: / usr/local/share/emacs/site - the lisp/git = = > [email protected] A CA file has had been bootstrapped using certificates from the system keychain. To add additional certificates, Place. Pem files in /usr/local/etc/[email protected]/certs and run /usr/local/opt/[email protected]/bin/c_rehash [email protected] is keg-only, which means it was not symlinked into /usr/local, Because macOS provides LibreSSL. If you need to have [email protected] first in your PATH run: echo 'export PATH="/ usr/local/opt/[email protected] / bin:$PATH"'>> ~/. ZSHRC For compilers to find [email protected] you may need to set: Export LDFLAGS=" -l /usr/local/opt/[email protected]/lib" export CPPFLAGS=" -i /usr/local/opt/[email protected]/include" For pkg-config To find [email protected] you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"Copy the code
➜ git version
git version 2.29.2
Copy the code