zoukankan      html  css  js  c++  java
  • git如何移除某文件的版本控制

    1:还没有加到版本控制中

         (1)还没有git  add

              在   .gitignore中添加

         (2)已经git add

              先   git  rm  -r  --cached   文件

              在   .gitignore中添加

    2:已经加到版本控制中

             先   git  rm  -r  --cached   文件 

            在   .gitignore中添加

            最后  gti commit -m  '提交.gitignore'

    注解:1git update-index --assume-unchanged <PATH>   这个命令能让Git假装看不见目标文件的改变,但文件本身还是在 Git 的历史记录里的,所以团队的每个人在

              fetch 的时候都会拉到目标 文件 的 变更。团队要每次对运行改命令,否则忽略不掉

            

    1. git update-index --assume-unchanged /path/to/file       #忽略跟踪  
    2.   
    3. git update-index --no-assume-unchanged /path/to/file  #恢复跟踪  

               2:  修改.gitignore添加完忽略文件,然后执行下列命令

    1. git rm -r --cached .  
    2. git add .  
    3. git commit -m 'update .gitignore'  

                 也是假装让git看不见文件,要团队中每个人都运行改命令,否则忽略不掉

  • 相关阅读:
    A1091. Acute Stroke
    A1103. Integer Factorization
    A1097. Deduplication on a Linked List
    A1074. Reversing Linked List
    设计模式之装饰模式
    基于UML的需求分析和系统设计
    软件测试开篇
    当抽象类遇到单例模式
    设计模式开篇
    此刻开始,点滴积累
  • 原文地址:https://www.cnblogs.com/lxwphp/p/15454381.html
Copyright © 2011-2022 走看看