I cloned a git repository from GitHub, made some changes and some commits; I made quite a lot and all are quite dirty, so they're not suitable for a pull request. Now I created the branch cleanchanges
from origin/master
, so it's clean, and I want to commit my changes there as one commit with a nice commit comment.
When I am on the local master, I want to switch to my cleanchanges
but without changing the files. And then I'm able to commit.
How can I switch branches without changing files?
I want to make it clear: I have all the changes committed in the local master
. There are no uncommitted changes.
It sounds like you made changes, committing them to master along the way, and now you want to combine them into a single commit.
If so, you want to rebase your commits, squashing them into a single commit.
I'm not entirely sure of what exactly you want, so I'm not going to tempt you with a script. But I suggest you read up on
git rebase
and the options for "squash"ing, and try a few things out.