Git 2.23 Compile Source

Git 2.23 has been released and introduces two new experimental commands: git switch & git restore.

Both commands should provide an alternative to git checkout which seems to do “too much”. The new commands are supposed to eliminate confusion by providing a more explicit naming.

Here a blog post about the highlights of this release

Unfortunally at the moment the binary files for MacOs are unavailable

Building Git from source code

I installed Git 2.23 on my MacOs Mojave compiling the source code.

You need to have Xcode installed (Xcode Commandline tools should be enough tho)

Install automake and autoconf packages with Brew

brew install autoconf automake

Create a working directory

take git source (if you use oh-my-zsh like me)

or

mkdir git-source && cd git-source

Clone the repo

git clone git://github.com/gitster/git.git

Move in the git directory

cd git

Configure

make configure

./configure --prefix=/usr/local

Build the binary

make prefix=/usr/local

Install

sudo make prefix=/usr/local install

Building the Git documentation

Exit the git directory

cd ..

Clone the man-pages

git clone https://github.com/gitster/git-manpages.git

Move back in the git directory

cd git (or cd -)

Build the Man Pages

make prefix=/usr/local

Install

sudo make quick-install-man

Check git version, you should see 2.23 installed

git --version
git version 2.23.0.37.g745f681289

Congrats! Now, check if the manpages are installed correctly

git help switch  

---

NAME
       git-switch - Switch branches

Done. Enjoy!

Linux Users Bonus:

https://gist.github.com/LeandroDCI/6a974eb5af69ce2a7d13a569896e3ab7

Troubleshooting:

If you have issues with Github authentication, check this