git 写了挺多内容了突然发现自己居然是在 master 分支上写的 希望带着已经写的内容去开一个新分支 怎么做?
資深大佬 : Newyorkcity 7
谢谢!
大佬有話說 (19)
已经 commit 的话可以开新的 branch,然后 cherry pick
没 commit 的话直接开新的 branch 就好了,active change 会带过去的
git fetch origin master
basically, you’ll need to reset the master branch.
1, 直接在 Master 建立分支。
2, 然后 Master 上 Reset –Hard 上个点,commit, push 。一般 –hard 还是慎用。
不过这种应该要避免,首先从切换到一个好的 Shell 开始(各种 OhMyXXX 系列),一般图形工具都是会标注当前分支。