On Apr 27, 9:12 pm, David Doria <daviddo...@gmail.com> wrote:
> I have to make a change in one file, call it Annoying.cpp, to get a
> library to work on my system. I then want to make other changes in
> other files, and produce a patch. I made several commits, just never
> 'git adding' Annoying.cpp. Now I want to squash the last several
> commits. When I do a 'git rebase' it yells that I haven't committed
> all of my changes. I don't want to commit them though so that they are
> not part of the patch. What can I do?
> I could 'git checkout Annoying.cpp' to do the rebase, but then I'll
> have to make the change again after the rebase. Is this the only
> option?

You might want to try git stash, which basically stores changes to
your working directory temporarily as a Git commit. This change can be
restored later.

In your case, you could just do a 'git stash' and your working
directory should be clean so that you can proceed with git rebase.
Once you're squashed all your commits, you can do 'git stash pop' and
you should have your changes back to your working directory. Now you
can commit this change as usual (git add, and then git commit). You
can also add this change to your squashed commit by 'git commit --

See git help stash for more info.



You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to