zoukankan      html  css  js  c++  java
  • git 删除误上传的.idea文件

    问题:
    提交项目的时候忘记添加.gitignore文件,误上传了文件(如.idea)如何解决?(本文以.idea文件夹举例)

    1.将项目文件拉取下来

    git pull origin master

    2.添加需要过滤的文件

    a. 如果你有.gitignore文件,但是没添加误上传的文件夹(如.idea)
    新起一行添加  .idea/
    b. 如果你没有.gitignore文件,在你的项目里创建一个.gitignore的文件
    将下面的文本放入即可
    

    通用.gitignore文件

    # Initially taken from Github's Python gitignore file
    
    # Byte-compiled / optimized / DLL files
    __pycache__/
    *.py[cod]
    *$py.class
    __pycache__
    # C extensions
    *.so
    .DS_Store
    .idea/
    # Distribution / packaging
    .Python
    build/
    develop-eggs/
    dist/
    downloads/
    eggs/
    .eggs/
    lib/
    lib64/
    parts/
    sdist/
    var/
    wheels/
    *.egg-info/
    .installed.cfg
    *.egg
    MANIFEST
    
    # PyInstaller
    #  Usually these files are written by a python script from a template
    #  before PyInstaller builds the exe, so as to inject date/other infos into it.
    *.manifest
    *.spec
    
    # Installer logs
    pip-log.txt
    pip-delete-this-directory.txt
    
    # Unit test / coverage reports
    htmlcov/
    .tox/
    .nox/
    .coverage
    .coverage.*
    .cache
    nosetests.xml
    coverage.xml
    *.cover
    .hypothesis/
    .pytest_cache/
    
    # Translations
    *.mo
    *.pot
    
    # Django stuff:
    *.log
    local_settings.py
    db.sqlite3
    
    # Flask stuff:
    instance/
    .webassets-cache
    
    # Scrapy stuff:
    .scrapy
    
    # Sphinx documentation
    docs/_build/
    
    # PyBuilder
    target/
    
    # Jupyter Notebook
    .ipynb_checkpoints
    
    # IPython
    profile_default/
    ipython_config.py
    
    # pyenv
    .python-version
    
    # celery beat schedule file
    celerybeat-schedule
    
    # SageMath parsed files
    *.sage.py
    
    # Environments
    .env
    .venv
    env/
    venv/
    ENV/
    env.bak/
    venv.bak/
    
    # Spyder project settings
    .spyderproject
    .spyproject
    
    # Rope project settings
    .ropeproject
    
    # mkdocs documentation
    /site
    
    # mypy
    .mypy_cache/
    .dmypy.json
    dmypy.json
    
    # Pyre type checker
    .pyre/
    
    data/
    model/
    
    

    3.打开项目终端执行命令

    # 删除github上的误上传文件.idea 
    git rm -rf --cached .idea    
    
    

    4.提交.gitignore文件

    git add .gitignore
    

    5.上传

    git commit -m '忽略idea'
    git push -u origin master
    
  • 相关阅读:
    如何正确得到某个元素的位置
    jQuery Tags Input Plugin(添加/删除标签插件)
    [转载]舒迅:产品经理必读的九步法
    不间断循环滚动代码
    jquery validate api
    jquery文件上传控件 Uploadify
    关于CSS权重问题
    css中fontfamily的中文字体
    expression解决IE6下固定定位的兼容
    模拟下拉select
  • 原文地址:https://www.cnblogs.com/trotl/p/11874108.html
Copyright © 2011-2022 走看看