git
回滾到歷時(shí)版本
找到歷史版本,執(zhí)行 reset:
git reset HEAD
然后強(qiáng)制推送:
git push -f
暫存
在切換分支時(shí),對(duì)于暫時(shí)不打算提交的代碼,可以先暫存一下:
git stash
查看歷史暫存:
git stash list
恢復(fù)暫存:
git stash apply stash@{id}
對(duì)于已恢復(fù)或者不使用的暫存,執(zhí)行刪除:
git stash drop stash@{id}
新增并提交
只針對(duì)于暫存的修改,新建的文件內(nèi)容無法使用:
git commit -am 'test'
上面命令相當(dāng)于:
git add .
git commit -m 'test'