我知道我们可以使用git checkout <branch> <file>
将file
从branch
转移到另一个分支,但我想知道的是我如何转移所有&#34; staged&#34 ; (虽然没有提交)文件,文件夹,删除等一次从branch-two
到branch-one
?
当前分支
ubuntu@ubuntu:~/project$ git branch
branch-one
* branch-two
develop
当前状态
ubuntu@ubuntu:~/project$ git status
On branch branch-two
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: dir-one/hello_one.txt
modified: file_one.txt
deleted: file_seven.txt
modified: file_two.txt
答案 0 :(得分:4)
git stash save
git checkout <other branch>
git stash apply