Git 2.23 extracts new commands from checkout

Git 2.23 extracts new commands from checkout

The team behind repository management tool Git has released version 2.23 of its project, bringing experimental commands to those that find checkout a bit too complex.

The additions in question are git switch and git restore, and meant to help with the separation of checkout operations that change branches from those that change files. Switch, for example, lets users jump to a specified branch and updates the working tree as well as the index to match it. The command can also be used to create a new branch.

Restore, meanwhile, is meant for restoring paths in the working tree, index content or both. Default restore sources for the working tree are the indices, while the index assumes HEAD as the standard restore source. To specify a different one, devs can make use of the –source option. 

Apart from that, the Git team fitted merge with a –quit option that lets you quit the merge process leaving the index and working tree unchanged. It’s that last part that makes it different from –abort, to finish the merge process if necessary but that may leave you with a slightly different working tree. 

Due to the incompatible nature of the options, merge won’t work in version 2.23 if both –squash and –commit are specified. Users should also finally be able to see edited log messages replace old ones during rebase merges when there’s otherwise no need for a new merge.

Another new option can be found in the form of skip for the cherry-pick operation. With it, devs can skip the current commit and continue with the rest of the cherry-pick sequence. Speaking of which, the command line prompt script should now get the current status if one step in a multi-step cherry-pick or revert is reset or commited.

Owners of large repositories can profit from a change in the handling of commit graphs: commits can now be described by multiple commit-graph files, that can be chained together. This means that commit-graph files can be updated incrementally, which equals less computational effort in complex projects, since the graph doesn’t need to be rewritten from scratch every time a new object is received. The option to turn of the calculation determining if a branch is behind a remote one per default can also help in large repository scenarios.

A complete list of changes can be found in the project’s documentation.