git - 使用具有不同分支的 git stash
问题描述
我有两个分支feature/A
和feature/B
. 我已经修改了文件feature/A
并应用git stash
命令来保存我的工作并git checkout feature/B
切换到其他分支。现在feature/B
我已经修改了文件并申请git stash
将工作保存在feature/B
.
现在,如果我想再次反映我必须应用的更改,git stash pop
但我的问题是两个分支的保存工作在我申请时立即反映,git stash pop
或者工作根据分支保存(即在feature/A
特定分支的工作中只反映和在feature/B
特定分支的工作中是体现)?
解决方案
返回feature/A
分支时,您可以按索引弹出或应用相关存储。考虑这个工作流程:
# work on feature/A
git stash
# work on feature/B
git checkout feature/B
git stash
# now return to feature/A and apply the first stash
git checkout feature/A
git stash apply "stash@{0}"
# switch to feature/B and apply the correct stash there
git checkout feature/B
git stash apply "stash@{1}"
推荐阅读
- javascript - 开玩笑 toMatchObject 抛出 TypeError
- python - 如何从返回的数据库中取出单个数据?
- angular - Ngif else 异步数据数据
- ionic-framework - 无法从文件 URI 显示图像,离子框架
- ios - 如何在 Swift 中重用字体?
- java - 即使有滚动,如何始终在 Android 中显示工具栏?
- docker - 日期格式 yyyy-MM-dd Docker iis
- mysql - Mysql Regex 以语言 iso 代码结尾,但不是其他字符(非字母)
- sql - SP2-0552:未声明绑定变量 - Oracle 版本相关
- nginx - 如何复制超过n秒的请求的nginx日志