Basic question but this happens to me all the time:
working-branch
master
git merg
If you already committed your changes to master
but didn't push to anywhere...
create a new branch for the last changes
git checkout -b newfeat master
replay all the changes (move the commits) on top of your working-branch
branch
git rebase --onto working-branch origin/master newfeat
change to master
branch and reset it to the state of the last push
git checkout master
git reset --hard origin/master
At this point you have:
master
pointing to the last pushed commit (origin/master
)working-branch
never changednewfeat
branch that contains all the new commits and is ahead of working-branch
.