Git Gets Better Defaults, Faster
Git 2.0 is finally released, almost a month after the first release candidate was available. This comes with performance improvements such as introduction of bit-map indexes, as well as sensible defaults, especially helping first-time users. For existing users, there are also options to keep functionality similar to previous versions, reducing impact to their workflows.
Git users were being primed from earlier releases for some of these features. Junio Hamano, maintainer of Git, says (excerpt) -
..(Some may even say) that the new release does not offer anything exciting—and that is exactly what we want to hear from existing users. In recent releases for the past year or so, we have added knobs to allow users to enable these new defaults before 2.0 happens, and added warnings to let users know when they perform an operation whose outcome will be different between 1.x series and 2.0 release. The existing users are hopefully very well prepared by now, and "Git 2.0" is designed to be the final "flipping the default" step.
Some of the major improved defaults are -
- push defaults to "simple" semantics (instead of "matching") - which pushes only the current branch to a branch in the remote with the same name
- "git add -u" and "git add -A", when run without path, operate on the entire tree even if run inside a subdirectory. You need to add an extra period ("git add -u ." or "git add -A .") to limit the add to current directory.
- "git add <path>" will not ignore removals, and in effect be same as "git add -A <path>"
Felipe Contreras explains these backward-incompatible differences in a bit more detail.
There are also several other improvements. Some of them are -
- "git grep" behaves in a way similar to native grep when "-h" (no header) and "-c" (count) options are given
- Many commands that create commits, such as "-pull" and "-rebase" take "--gpg-sign" option on the command line (read more about Signed commits)
- Several new options such as "pull.ff" (accept only fast-forward), "-N" option for "git reset", "commit.gpgsign" (always sign when using "git commit")
- Trailing whitespaces in .gitignore files are warned and ignored (unless they are quoted)
Several performance and implementation improvements, such as -
- bitmap-index feature from JGit has been ported, which if used, significantly improves the counting phase of the clone and fetch operations (at the cost of extra disk space used by indexes)
- The way "git log --cc" shows a combined diff against multiple parents has been optimized
You can learn more about all the changes as well as all the fixes in the release notes.
Yoni Goldberg Oct 30, 2014
Dmytro Svarytsevych Oct 30, 2014