当要经常中断,修复bug时,导致弄乱正在进行中的工作时,那么需要储藏stash。
- git stash save
储存当前modify内容,若要储存add的内容,需要加-u。
注意并不是-a,-a会导致未跟踪的文件,.gitignore以及exclude文件中明确忽略的文件被存储。
toney@sw2:~/work/project/dragon/core/code/customer/cus_dlinkg2$ git status
On branch AAA
Untracked files:
(use "git add <file>..." to include in what will be committed)
123.c
nothing added to commit but untracked files present (use "git add" to track)
toney@sw2:~/work/project/dragon/core/code/customer/cus_dlinkg2$ git stash save -u 123
Saved working directory and index state On AAA: 123
HEAD is now at e10192d b
- git stash list
查看储藏信息:
toney@sw2:~/work/project/dragon/core/code/customer/cus_dlinkg2$ git stash list
stash@{0}: On AAA: 123
- git stash apply
从储藏中取出内容&