Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Git 2.5 Adds Worktrees, Improves Triangular Workflows, Performance, and More

Git 2.5 Adds Worktrees, Improves Triangular Workflows, Performance, and More

This item in japanese


Git 2.5 is a major feature release that includes worktrees, improved triangular workflows, better performance, and countless improvements and fixes.


Worktrees are a new experimental feature that allows developers to create additional working trees within the same Git repository. This feature aims at making it easier to work on two branches simultaneously, whereas older Git versions only allowed to switch between branches, with only one branch active at a given time, or create a second local clone, which usually entailed extra work to keep them in sync.

In order to create a new working tree, Git provides the worktree command:

$ git worktree add -b hotfix ../hotfix origin/master

This will create a new directory at the specified location, e.g. ../hotfix, a new branch from origin/master, and will check it out in that directory.

Using a second working tree can be useful to, e.g., run long-running tests on the current version, while working on the next version branch, or to make a urgent fix without switching out of the current branch.

Working trees are linked to the main repository and all know about each other. So, it is not allowed to check out the same branch in two different working trees, to prevent the two working trees from going out of sync.

Triangular workflows

Triangular workflows are commonly used to coordinate a team of contributors. The basic ideas is that contributors have their own forks and, when ready to share their work, they create a pull request that will eventually be merged into the main repository.

To make triangular workflows easier to deal with, Git 2.5 adds a new @{push} notation to denote the current value of the remote-tracking branch that the current branch would be pushed to. This can be used to, e.g., list all of the commits that have been added to the current branch since the last push:

$ git log @{push}

or alternatively:

$ git log whizbang@{push}

to use an arbitrary branch.


Git 2.5 improves performance when working with large working trees and networked filesystems:

  • git update-index --untracked-cache will enable an experimental feature that will make Git examine only the modification times of directories to improve git status performance.
  • git index-pack makes fewer scans of the packed-refs directory to improve performance with networked filesystems.
  • utime will be called less frequently when reusing existing packed objects, with benefits on networked filesystems.

Besides that, Git 2.5 improves support of Perforce repositories by letting git p4 detect filetypes, handle branches better, and many more enhancements and fixes that you can read about in the release notes.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • the question is will it help github?

    by peter lin,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I find the way github uses GIT to be unproductive and a pain. The way they force you to fork, merge, rebase, etc makes using GIT more painful than it needs to be. I prefer the way bitbucket uses GIT. Hopefully these new features will help github suck less.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p