Git Product home page Git Product logo

git-test's Introduction

熟悉git操作的文档

-- 一丶操作目的: 删除远程仓库的.idea文件,但本地的文件保留。每次提交,不需要push此文件。 要实现上面的目标很简单,只需几个命令就行。不过为了清楚命令的具体作用,还是从下面的几个概念了解开始。

git原理图中的专用名词含义为:

workspace:工作区,idea里写的代码,保存了就在workspace。 index/stage:暂存区,git add命令执行后,会将代码存入stage/index。 repository:仓库区(或本地仓库),git commit命令执行后,代码会存入repository中。 remote:远程仓库,git push之后,代码会存入remote。

  1. .gitignore文件 第一步,添加.gitignore文件,在里面添加内容: ./idea

    如果你工程代码中存在.gitignore文件,且含有上面的内容。但是却没有达到忽略效果的原因是:.gitignore文件只会ignore没有被staged的文件。也就是说,之所以.idea能push到remote远程仓库,是因为你已经执行了git add命令。

  2. git中删除.idea 第二步,执行命令git rm --cached -r .idea,该命令的作用是删除暂存区或分支上的文件,停止追踪指定文件,但该文件会保留在工作区。这样相当于stage中没有.idea文件。

  3. 追踪.gitignore文件并提交 第三步,执行命令git add .以及git commit -m "删除.idea"。

  4. push变化内容到remote 第四步,执行命令git push。

二丶如果是单纯删除本地加远程仓库的文件,之间打开version control --> log --> 右键文件 --> git 打开,点进去可视化删除即可 -- 回到idea,进行git pull 同步。

git-test's People

Contributors

leon0401 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.