Git Stash

  • save stash

    $ git stash
    
  • list stash

    $ git stash list
    
  • apply stash

    #apply the latest stash
    $ git stash apply
    
    #apply older stash
    $ git stash apply stash@{2}
    
  • pop stash

    #apply the lastest stash and drop it
    $ git stash pop
    
  • drop stash

    $ git stash drop stash@{0}
    
  • Creative Stashing

    #not stash anything that you've already stages
    $ git stash --keep-index
    
    #also stash any untracked files
    $ git stash -u
    
    #prompt you interactively which of the changes you would like to stash and which you would like to keep in your working directory
    $ git stash --patch
    
    #creates a new branch for you, checks out the commit you were on when you stashed your work, reapplies your work there, and then drops the stash if it applies successfully
    $ git stash branch testchanges
    

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 简评:如果你用过一段时间的 Git,你可能会用过 Git stash 命令。它是 Git 最有用的功能之一。以下是...
    极小光阅读 12,550评论 1 15
  • 一、常用git stash命令: 1、git stash 能够将所有未提交的修改(工作区和暂存区)保存至堆栈中,用...
    宇宙小神特别萌阅读 4,735评论 2 3
  • 自己寻找的东西,内心的注意力在开启,而平时听到看到的,往往不能渗到深处。带着问题看书,效果大不一样。修行也是这样,...
    石竹阅读 164评论 6 6
  • 前言 最近公司产品想更改APP整体的字体,并且H5页面的字体也要与APP原生的字体保持一致。 1.APP更改字体 ...
    低调的前行者灬阅读 4,742评论 4 2
  • “20多岁女孩的生活应该是什么样的呢?” 在网上看到一个词,叫“假甜女孩”,说的是那些看上去小鸟依人需要保护,实际...
    谙黍先生阅读 112评论 0 0