Git your updates now: Version control system hits 2.30, preps for main switch

Git 2.30

Git maintainer Junio C Hamano recently pushed version 2.30 of the version control software out the door, featuring enhancements to command line completion, a safer option to force push commits, and various fixes to rectify checkout and rebase issues.

Since the last version update, which was released in October 2020,  the Git team put some effort into the diff command family, which in version 2.30 comes with the option -I<regex> for ignoring “hunks whose changed lines all match the given pattern”. Users can now also use the maybe more intuitive git diff –merge-base A B instead of git diff A…B.

Since git stash show takes the same options as diff, the command line completion script was changed to reflect that fact, and now also expands commands that are alias of alias. Teams who feel that using force-pushes is misused at times can now try the new option –force-if-includes, which tries to reduce the number of lost commits by checking if a replacement was created after the to be replaced commit was examined. 

Git’s worktree list also helps to keep track of the state of things by signaling if a worktree is locked with more additions to land in future releases. Git now allows for higher compression when generating tar.gz output. It has also learned to accept a line with a lone carriage return on it as a blank line, which allows for a separation between commit title and message, should that be something you always wanted to do.

In earlier versions, scripted callers weren’t able to use exit codes issued by commands like git remote add, which was fixed in Git 2.30, while a new git rev-parse parameter called –end-of-options looks to support scripts in safely taking revision parameters..

As many open source projects looked to the Git project for guidance and/or support regarding a move away from master as the default initial branch name last year, it’s worth noting that the team has continued their preparations for a switch to main by adjusting internal tests to accommodate for a different name. In July 2020 the project acknowledged its naming scheme was “offensive to some people” and introduced an option for admins to set a more meaningful standard name for new repos.

Other than that the Git team kept working on its rewriting of git bisect in C, taught commands like git diff to take advantage of fsmonitor data when comparing with working tree files, and introduced a hashmap specialisation that uses a string as key.

The full list of changes can be found on the Git mailing list.