How can I get a list of Git branches, ordered by most recent commit?

Use the –sort=-committerdate option of git for-each-ref; Also available since Git 2.7.0 for git branch: Basic Usage: git for-each-ref –sort=-committerdate refs/heads/ # Or using git branch (since version 2.7.0) git branch –sort=-committerdate # DESC git branch –sort=committerdate # ASC Result: Advanced Usage: git for-each-ref –sort=committerdate refs/heads/ –format=”%(HEAD) %(color:yellow)%(refname:short)%(color:reset) – %(color:red)%(objectname:short)%(color:reset) – %(contents:subject) – %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))” … Read more

What are the differences between git branch, fork, fetch, merge, rebase and clone?

Git This answer includes GitHub as many folks have asked about that too. Local repositories Git (locally) has a directory (.git) which you commit your files to and this is your ‘local repository’. This is different from systems like SVN where you add and commit to the remote repository immediately. Git stores each version of … Read more

What is a tracking branch?

The ProGit book has a very good explanation: Tracking Branches Checking out a local branch from a remote branch automatically creates what is called a tracking branch. Tracking branches are local branches that have a direct relationship to a remote branch. If you’re on a tracking branch and type git push, Git automatically knows which … Read more

Trimming Git Commits/Squashing Git History

Edited answer with now (in the second half of this entry) the new Git1.7 fixup! action and –autosquash option for quick commit reordering and message editing. First, the classic squashing process, as done before Git1.7. (Git1.7 has the same process, only made faster by the possibility of automatic commit reordering as opposed to manual reordering, … Read more