zoukankan      html  css  js  c++  java
  • git 回滚到上个版本命令以及忽略某些文件提交

      1.git回滚到上个版本

    git reset --hard FETCH_HEAD

    2.git忽略某些文件的提交

     以前是用默认的.gitignore 然后再里面默认某些文件不提交。但是有个问题,.gitignore忽略不掉。因为这是一个全局的。可以改为这样子:

       找到 隐藏的.git文件夹,在里面编辑.git/info/exclude文件(如果没有info则创建,默认是没有的),把要忽略的给编辑到exclude里面。

      语法与.gitignore一致。两个文件区别在于,exclude只用于设置本地需要忽略的文件,而.gitignore是公共需要排除的。比如

    # git ls-files --others --exclude-from=.git/info/exclude
    # Lines that start with '#' are comments.
    # For a project mostly in C, the following would be a good set of
    # exclude patterns (uncomment them if you want to use them):
    # *.[oa]
    # *~
    # Compiled class file
    *.class

    # Log file
    *.log

    # BlueJ files
    *.ctxt

    # Mobile Tools for Java (J2ME)
    .mtj.tmp/

    # Package Files #
    *.jar
    *.war
    *.ear
    *.zip
    *.tar.gz
    *.rar
    zm-mc/target/
    zm-mc/.gitignore
    zm-mc/src/main/resources/rebel-remote.xml
    zm-mc/src/main/resources/rebel.xml
    .gitignore
    # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
    hs_err_pid*

       

  • 相关阅读:
    第九章 读书笔记
    第八章 读书笔记
    第七章 读书笔记
    第六章 读书笔记
    第五章 读书笔记
    第四章读书笔记
    第三章读书笔记
    第九章 硬件抽象层:HAL
    第10章 嵌入式linux的调试技术
    第八章 蜂鸣器驱动
  • 原文地址:https://www.cnblogs.com/thinkingandworkinghard/p/7069121.html
Copyright © 2011-2022 走看看