Git: Merge in only one commit
05:53 05 Jan 2011

Usually, I work with branches in Git, but I don't like to see hundreds of branches in my working tree (Git history). I'm wondering if there is a method in Git to "join" all commits in a branch in only one commit (ideally with a clear commit message).

Something like this:

git checkout -b branch

git commit -a -m "commit 1"

git commit -a -m "commit 2"

git commit -a -m "commit 3"
git checkout master
git SUPER-JOIN branch -m "super commit"

After this, only "super commit" will exist in the git log.

git branch