zoukankan      html  css  js  c++  java
  • git stash部分文件

    情景描述:
    修改大量文件需要提交,其中一个或多个文件为只针对于本地的环境配置文件,例如proxy.js/ts文件,在不提交这些本地配置文件的情况下提交剩余其他文件。
    1.查看当前状态,确定不需要提交的文件

    git status

    2.逐个文件判断是否需要stash,需要的y 不需要的n

    git stash -p //它是一个交互式命令,我们可以一个文件一个文件的遍历,决定每个文件的操作方式.

    root /u/c/s/cbs (master)# git stash -p
    diff --git a/cmd/scripts/cbs.sh b/cmd/scripts/cbs.sh
    old mode 100644
    new mode 100755
    Stash mode change [y,n,q,a,d,/,?]? 
    

    [y,n,q,a,d,/,?] //代表的意思:

       y - stage this hunk
       n - do not stage this hunk
       q - quit; do not stage this hunk nor any of the remaining ones
       a - stage this hunk and all later hunks in the file
       d - do not stage this hunk nor any of the later hunks in the file
       g - select a hunk to go to
       / - search for a hunk matching the given regex
       j - leave this hunk undecided, see next undecided hunk
       J - leave this hunk undecided, see next hunk
       k - leave this hunk undecided, see previous undecided hunk
       K - leave this hunk undecided, see previous hunk
       s - split the current hunk into smaller hunks
       e - manually edit the current hunk
       ? - print help
    
    遇到我们需要stash的文件,我们就y,不需要stash需要commit的文件,我们就n,如果接下来没有需要stash的文件,则直接q退出就行.
    恢复stash

    git stash pop //恢复最近一次

  • 相关阅读:
    JAVA基础之(十三)“集合”
    JAVA基础之(十二)“泛型”
    JAVA基础之(五)”继承“
    算法--验证时间段不交叉/不重复的方法
    工具类--常量类
    工具--常见eclipse配置导入web工程(tomcat容器)步骤
    jar包--POI.jar包使用问题汇总
    java中常忽视的小问题
    ResultSetMetaData
    PreparedStatement
  • 原文地址:https://www.cnblogs.com/xuchao-blogs/p/14817714.html
Copyright © 2011-2022 走看看