• Git如何丢弃某些未暂存的内容
  • 发布于 2个月前
  • 646 热度
    0 评论
  • 王晶
  • 0 粉丝 64 篇博客
  •   
如果你想丢弃工作拷贝中的一部分内容,而不是全部。签出(checkout)不需要的内容,保留需要的。
$ git checkout -p
# Answer y to all of the snippets you want to drop
另外一个方法是使用 stash, Stash所有要保留下的内容, 重置工作拷贝, 重新应用保留的部分。
$ git stash -p
# Select all of the snippets you want to save
$ git reset --hard
$ git stash pop
或者, stash 你不需要的部分, 然后stash drop。
$ git stash -p
# Select all of the snippets you don't want to save
$ git stash drop

用户评论