It happened: Git 2.0 is here and it’s full of goodies

This major release of git has been brewing for a long time and I am excited to go on the hunt in the Changelog to find cool bits of awesomeness. As usual if you want to catch up with past git releases, I’ve been doing this exercise for a while, check them out: 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.9.

This piece will necessarily cover only a selection of the release, if you want the complete list of changes and bug fixes have a look at the full Changelog.

Some defaults changing: improving usability and resolving confusion

Let’s tackle the compatibility changes first. There are a few and I’d say these are welcome updates for misunderstandings that have bugged more than a beginner. They should not disrupt old experienced git users too much because they can very easily revert to their favorite setups by tweaking their .gitconfig a bit.

IMPORTANT! git push (with no arguments) defaults to simple push mechanics

The default behavior of bare git push with no arguments has traditionally been non-intuitive: All branches were sent to the remote as long as their name matched both locally and remotely. That’s what the matching option meant.

In Git 2.0 the default has been changed to simple which is narrower in scope – more specific and more intuitive – it will now only push:

If you are nostalgic and got accustomed to the old default you can switch back setting the configuration variable push.default to matching again.

git add path now equates git add -A path

git add dir/ will notice paths you removed from the directory and record the removals. A great usability improvement. In older versions git add path used to ignore removals. You can be explicit with git add –ignore-removal path if you want to keep the old behavior.

git add -u and git add -A now operate on the entire tree and not on the sub-folder where you happen to run the command (this makes the two commands behave in the same way as the other git commands). You can still specify the . folder if you want the old behavior.

git svn default prefixes change

The default remote prefix for git svn has changed in Git 2.0 and it now places remote-tracking branches under refs/remotes/origin (instead of directly under refs/remote). This can be customized using the –prefix option of git svn.

Non-breaking changes grouped by command

The changes below do not break compatibility. They caught my eye as being useful or interesting.

git log has a new option –show-linear-break and more

git rebase can now sign commits

git commit gains a new cleanup mode and more

git tag now can sort numbered versions

Other miscellaneous changes

Conclusion

I hope you found this run down useful. Stay tuned for more on this channel! Follow me @durdn for more hacking and DVCS rocking.

Check out more Git goodies from Atlassian:
Git blogs on developer.atlassian.com
Getting Git Right

Exit mobile version