I want to simply squash a bunch of git commits that are no longer needed. I attempted to follow documentation from this site, but I ended up with git saying there is nothing to squash. I only have one branch, so I followed that section. Any ideas?
If I were doing it I'd use "rebase". Assuming you have your branch checked out, and that it is branched from master, do
git rebase -i master
This will allow you to modify the commits from master to your current branch. In your case, replace
fixup, which is a squash that drops the commit message of the squashed commit). Save and exit (ZZ in Vim), and rebase will do its magic. Rebase is a more general solution as in the same operation you can remove, re-order, and reword commits.
The rebase settings will open in Vim, or whichever editor you set in the
EDITOR environment variable. In Vim, navigate to start of the line with the commit you wish to squash (with arrow keys or mouse),
cw to delete
pick and enter insert mode,
f for fixup or
s for squash, then
ZZ to save and exit.
As a side note, the link you gave suggests flatting your feature branch into a single commit. In my opinion this is an awful idea. Commits should represent a meaningful set of changes. A branch is the set of these changes that represents a feature. Squashing everything into one huge commit means it will be harder for other developers to follow your changes.