I'm trying to squash a few commits into a pull-request-ready package for a github project I'm hoping to contribute to, but using git rebase -i master isn't giving me the options I expect (based on reading on StackOverflow and elsewhere. This is the first time I've attempted to squash commits, so I'm probably just missing something.
The history of the project is something along the lines of:
# On branch master git pull origin master git fetch upstream git rebase upstream/master git checkout -b feature git commit -m "some work" git commit -m "a little more work" git commit -m "finishing up feature" git checkout master git pull origin master git fetch upstream git rebase upstream/master git checkout feature at this point there have been no changes in origin/master or upstream/master, so even without rebasing my feature branch is linear with both origin and upstream. When I do git rebase -i master, none of my commits are listed in the editor that pops up, which is completely blank, and the output of the rebase is Successfully rebased and updated refs/heads/feature.
I know I could use
git checkout master git merge --squash feature but my understanding is that I'll lose all the history if I do that.
Is there another way to accomplish what I want, or am I just missing the obvious?
UPDATE
What I expect to see is an editor with the commits I've made in my feature branch listed so that I can select which ones to pick and which to squash. What I actually see is an empty editor, which makes me wonder if because my current branch is linear to my master branch, nothing needs to be rebased and so no commits show up in the editor (although I suppose I would have expected to get a "nothing to rebase" sort of message instead of the success message noted above)
git rebase -i mastershould do what you expect if you havefeaturechecked out. Trygit rebase -i master featureif you're not onfeaturealready.feature, and trying your suggestion results in the same behavior, but thanks!gitk --all(orgit log --graph, or the gui of your choice ...) show the relationship between origin/master, upstream/master, master and feature?