I have a refactoring/cleanup branch cleanup where I clean up technical debt. After going through one cycle, I merge this branch back into master.
A few weeks later, I have the time to clean up some more and I wanted to resurrect the branch instead of creating a new one. So I pulled master and then moved the local branch pointer for cleanup to HEAD:
> git show HEAD
commit dd61...
> git branch -f cleanup dd61...
> git checkout cleanup
After this, I could pull and push and the history looked correct. But I had some subtle problems when trying to pull in the latest changes and do a rebase. My usual workflow to rebase the current branch is:
> git pull origin master
> git rebase master
But when I do it with the resurrected branch, then the git pull will already start a merge or maybe even a rebase even though I didn't specify --rebase.
My guess is that I should have moved the remote branch pointer as well. I did push cleanup after the checkout above but maybe that wasn't enough?
Can someone explain what is going on in my situation and how I can resurrect a shared (= was pushed to origin) branch correctly?
After you moved pointer to
dd61you should dopush origin cleanup --forceto move it onorigin