忘了在git中分支,需要从主服务器移动更改
这个问题在这里已经有了答案:
  如果还没有提交到任何地方( git status显示了一堆修改过的东西,如果它是“git add”,也可以): 
$ git checkout -b newbranch
  尽管名称checkout这个用法(带-b )不检查任何东西。  -b标志表示“创建一个新的分支”,所以git创建分支名称并使其对应于当前的HEAD提交。  然后它使HEAD指向新分支,并停在那里。 
  因此,您的下一个提交是在newbranch ,它以父提交的形式提供了您在开始修改文件时所进行的提交。  假设你是master ,并且你有这些提交: 
A - B - C       <-- HEAD=master
  checkout -b使这读: 
A - B - C       <-- master, HEAD=newbranch
  并在稍后的提交中添加一个新的提交D : 
A - B - C       <-- master
          
            D   <-- newbranch
git stash
git stash branch <branchname>
git branch -M master my-branch
接着
git fetch origin refs/heads/master:refs/heads/master
要么
git branch master my-branch  (or another ref)
上一篇: Forgot to branch in git, need to move changes from master
