Git is the probably the most popular version control system that exists today and today the project released an interesting new version.

What’s new

There are two new interesting new experimental commands in this new version of Git which are briefly explained bellow. The GitHub blog explains these features in detail.

Switch and Restore

Git was not exactly the most user friendly solution out there at first and although it is very consistent and well designed it still leaves some newbies confused. This new version bring two experimental commands to fix that problem: switch and restore.

Both switch and restore are meant to replace checkout. The checkout command is used to either switch branches or to restore the working tree files. The purpose of these two new commands is to make a clear separation of these two features.

So instead of the following operations with checkout:

// Switch to another branch
$ git checkout branch

// Create a new branch
$ git checkout -b branch

// Restore a file to match index
$ git checkout -- file

You can use switch and restore instead:

// Switch to another branch
$ git switch branch

// Create a new branch
$ git switch -c branch

// Restore a file to match index
$ git restore file

So this does make both feature a lot easier to understand. Useful but still experimental. Expect changes in the future.

Other

There are other updates but not nearly as cool for the newbies as the above:

  • Performance improvements in for-each-ref
  • Possibility to quit in the middle of a merge without reverting changes
  • A better way to skip commits in a cherry pick list
  • New commands for multi-pack-index, repack and expire
  • Grep and diff show function option support Octave and Rust
  • Better support for mailmap (multiple email)