Reputation: 395
This is the order of actions which caused this problem.
git fetch
to get the new Branch and issued a git checkout v1_adminui
git checkout v1_adminui
complained that I need to commit first because v1_adminui has some files edited which I was working ongit add --all
and git commit -a -m "Changes to Admin UI"
then did the git checkout v1_adminui
How do I get my admin ui changes to v1_adminui? It looks like the commit
happened to v1 so now I'm stuck... Any help would be great please.
Note that I can't push that commit, it needs to be reviewed first before merging.
Upvotes: 0
Views: 34
Reputation: 426
This should be a fairly straightforward fix. First, look at the documentation for git cherry-pick
here. Then, when you understand what that's doing, take the following actions:
First, delete your local v1_adminui
branch, since it is, at this point, exactly the same as your v1
branch.
git checkout v1
git branch -D v1_adminui
Next, checkout the commit before you added all your adminui stuff
git checkout HEAD~1
Now, make a "new" v1_adminui
branch from that commit
git checkout -b v1_adminui
Next, grab the commit you want from your local copy of v1
(this assumes that commit is on top of your v1
branch.
git cherry-pick --no-commit v1
Now, your index will look as if you had made all of your adminui changes on your v1_adminui
branch, but haven't yet committed. Commit those changes:
git add -A
git commit -m "<some-message-here>"
Now, your v1_adminui
branch will have all the changes that you wanted to have there.
Lastly, if you want your v1
branch NOT to have those changes, go back to it
git checkout v1
and reset them (this assumes that you only made one commit that you no longer want there.
git reset --hard HEAD~1
Make sure you are careful with reset --hard
(check docs here)
Upvotes: 1