Git 2.26 sets protocol v2 as default and updates git sparse-checkout

Share
  • March 25, 2020

Git 2.26 has been released. The open source Git project announced the latest version on the GitHub Blog. Let’s dive right in and take a look at the new and updated features.

SEE ALSO: Gitea 1.11.0: Open source self-hosting Git solution gets a new update

Updates for git sparse-checkout

The sub-command git sparse-checkout was first introduced in Git 2.25 to replace more complicated .gitignore patterns in .git/info/sparse-checkout and make working with partial clones and sparse checkouts easier.

In Git 2.26, the “cone” mode of git sparse-checkout has been refined, and the additional mode git sparse-checkout add is now included.

The git sparse-checkout add mode lets you add new dictionary entries one at a time, as demonstrated in the blog post:

$ git clone --filter=blob:none --sparse [email protected]:git/git.git
Cloning into 'git'...
remote: Enumerating objects: 175470, done.
remote: Total 175470 (delta 0), reused 0 (delta 0), pack-reused 175470
Receiving objects: 100% (175470/175470), 59.07 MiB | 10.48 MiB/s, done.
Resolving deltas: 100% (111328/111328), done.
remote: Enumerating objects: 379, done.
remote: Counting objects: 100% (379/379), done.
remote: Compressing objects: 100% (379/379), done.
remote: Total 431 (delta 0), reused 0 (delta 0), pack-reused 52
Receiving objects: 100% (431/431), 1.73 MiB | 4.06 MiB/s, done.
Updating files: 100% (432/432), done.

$ cd git

$ git sparse-checkout init --cone
$ git sparse-checkout add t
remote: Enumerating objects: 797, done.
# ...
Updating files: 100% (1946/1946), done.

$ git sparse-checkout add Documentation
remote: Enumerating objects: 334, done.
# ...
Updating files: 100% (723/723), done.

$ git sparse-checkout list
Documentation
t
     

    International JavaScript Conference
    Manfred Steyer

    The Future of Angular and your Architectures with Ivy

    by Manfred Steyer (SOFTWAREarchitekt.at)

    Andrey Goncharov

    React: Lifting state up is killing your app

    by Andrey Goncharov (Hazelcast)

     

    Other updates

    Version 2 of Git’s network fetch protocol arrived in 2018. With Git 2.26, it is now set as default, which should bring several benefits. For example, it should increase the speed of fetches from large repositories. Although v2 is now the default, clients will fall back to the original protocol if the server does not support the new one.

    Git 2.26 also introduces new config options, one of which is --show-scope that works similarly to --show-origin and can be combined with it, but is less verbose.

    This is how --show-scope looks when used alone:

$ git config --show-scope --get-regexp 'diff.*'
global  diff.statgraphwidth 35
local   diff.colormoved plain

$ git config --global --unset diff.statgraphwidth

And here --show-scope is used in combination with --show-origin:

$ git config --list --show-scope --show-origin
global  file:/home/user/.gitconfig      diff.interhunkcontext=1
global  file:/home/user/.gitconfig      push.default=current
[...]
local   file:.git/config      branch.master.remote=origin
local   file:.git/config      branch.master.merge=refs/heads/master

When comparing changes in two branches, Git users now have the option to specify “bright” for colors that have ANSI escape sequences. This means you can choose bright blue by typing %C(brightblue).

SEE ALSO: GitHub Mobile is now generally available for Android & iOS

For further details on Git 2.26, see the GitHub blog post.

The post Git 2.26 sets protocol v2 as default and updates git sparse-checkout appeared first on JAXenter.

Source : JAXenter