git clone [url] 从现有项目克隆
切换分支时,保留修改到暂存区
保存:
git stash
git stash list 查看stash列表
git stash save "work
in progress for foo feature" (推荐 多次stash后)
git
stash save -u "messeag" 加入了代码新文件的开发的stash
从保留区恢复:
git stash pop 其对应的stash
在队列中删除
git
stash apply stash@{1} (或git stash pop stash@{num})
pop 与apply 区别:apply不在stash队列删,其他和git stash pop 完全一样
删除:
git
stash clear 清空stash队列
git
stash drop <stash@{id}>
git checkout . #本地所有修改的。没有的提交的,都返回到原来的状态
git stash #把所有没有提交的修改暂存到stash里面。 git reset --hard HASH #返回到某个节点,不保留修改。 git reset --soft HASH #返回到某个节点。保留修改
ps: 解决pull远程代码后和恢复stash冲突:
git status
git add 冲突文件
参考:http://blog.youkuaiyun.com/longxiaowu/article/details/26815433