Reputation: 5970
I'm working on my current master and have done quite a few changes which are as of now neither locally nor remotely committed. However, I am ready to commit them. Before doing so I would like to turn the current master without these uncommitted changes into a new branch but I am not completely sure what the right procedure for this is. My first idea was to do a clean clone in a different directory
git clone REPO
and then initialize a new branch from the current master
git checkout -b OLD_MASTER
and then commit. Then go back into the other clone which contains the uncommitted changes and commit them. But that seems unclean to me. What is the right way to achieve my goal?
Upvotes: 2
Views: 219
Reputation: 3647
You can create the branch and go back to master:
git stash
git checkout -b old_master
git checkout master
git stash pop
But don't you want a tag
instead?
git tag old_master
Upvotes: 4