$ git add . //现在在dev分支,代码添加文件到暂存区,但是没有commit $ git stash //把代码暂存起来 $ git checkout master //切回主线 $ git checkout -b EmergencyIssue //创建分支修改EmergencyIssue //After one hour...... EmergencyIssue fixed. $ git checkout master //修改好之后切回主线 $ git merge --no-ff -m "merged bug fix EmergencyIssue" iEmergencyIssue //分支合并 $ git branch -d EmergencyIssue //删除分支 $ git checkout dev //切回dev的分支 $ git status //查看状态,但是发现什么都没有 $ git stash list //可以看到暂存区存起来的list //stash@{0}: WIP on dev: 888888 add merge $ git stash pop //恢复stash后并删除stash的内容 $ git stash list