You can use a git interactive rebase to "squash" your commits into one.
# To squash 2 commits
git rebase -i HEAD~2
or
# To squash back to a specific commit identified by it's sha1
git rebase -i a3ea79f
If you have a commit history like this:-
git log --oneline --decorate
* d6f7bbd (HEAD, master) added test2
* 35dde7a added test1
* a3ea79f initial commit
Rebasing with either of the rebase commands above will open the editor. It will look something like this and modifying the "pick" lines will adjust the commits:-
pick 35dde7a added test1
pick d6f7bbd added test2
# Rebase a3ea79f..d6f7bbd onto a3ea79f
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out