Search code examples
gitsvngithubpycharm

How do I re-attach my head in pycharm?


Update: this seems to certainly be what I need. However when I follow the intstructions I am stuck as to how I can get my develop branch to point to my temp branch

i.e. How do I execute the following commands in pycharm:

git branch -f develop temp
git checkout master

I was on the "Trying to crop all frames..." commit (commit f4b641d) and I needed to go back to the previous commit temporarily just to look around. I did so with Checkout Revision and then afterwards I went back to commit f4b641 with another checkout revision though I forced it since I didn't care about lost local changes while.

Either way, I now see in the bottom right of the pycharm GUI (see first image) that I am no longer in the develop branch. So I have been developing on the f4b641 branch and now wish to commit and push my changes in this branch back to the develop branch on github. How do I reattatch my head in pycharm without losing my changes?

The warning dialog informs me I should checkout a branch to avoid losing my work, but if I do that I'll lose my local changes wont I?

enter image description here

enter image description here


Solution

  • Ran into this problem again a year later. Pycharm's UI is insufficient so assuming I've checked out a commit and reset the HEAD there (and I want master to be here) run:

    git branch -f master HEAD && git checkout master