Equivalent for "git checkout -"
已回答
Hi,
On the command line I often use "git checkout -" to go back to the previously checked out branch. For example,
1) Make a new branch and do some development work
2) Receive a notification that there have been changes to the `master` branch
3) Checkout the master branch and pull the changes
4) Type `git checkout -` to go back to my development branch (without having to remember what it was called)
5) Rebase development changes
Is there a keyboard shortcut in PyCharm that will let me do the same workflow? I'm already confident with switching to a named branch in PyCharm and rebasing, it's just the "go back to the previous branch you were working on" shortcut I can't find.
Craig
请先登录再写评论。
While there is no a shortcut for this (actually, there is no shortcut to checkout branch at all), when you open the Branches pop-up, the previous branch is automatically pre-selected.
So you could assign a shortcut to open the Branches pop-up, and checkout the pre-selected branch
I have assigned keyboard shortcut to open the branches popup, and use that to checkout branches because I can type a branch name it will find it. e.g. "CMD +B, m, a, s" is normally enough to highlight the master branch, which I can checkout by pressing ENTER.
For me the branches popup either has the "New Branch" option selected when it opens, or a random branch (normally one that I haven't been working on for months). Definitely not the most recently worked on branch that is not the current one.
What version are you on? There was a bug that has been fixed: https://youtrack.jetbrains.com/issue/IDEA-168024
Also, could be that the previous branch is hidden under the Show more action, if this is the case, please vote for https://youtrack.jetbrains.com/issue/IDEA-173941