Giter Club home page Giter Club logo

progit's Introduction

git 学习

progit

progit-cn

查看当前仓库状态

git status

# 省略版
git status -s
#
git status --short
# ?? --> 未添加到仓库的文件
# M  --> 修改的文件
# A  --> 新加入的文件

不追踪的文件 -- .gitignore

image

有时候不起作用原因:新建的文件在git中会有缓存,如果某些文件已经被纳入了版本管理中,就算是在.gitignore中已经声明了忽略路径也是不起作用的,这时候我们就应该先把本地缓存删除,然后再进行git的push,这样就不会出现忽略的文件了。git清除本地缓存命令如下:

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

查看已经提交的文件内容

# 如果已经提交(commit) git diff 无输出

# 最近的提交内容,两条语句一样
git diff --staged 
git diff --cached 

删除文件

# 删除git仓库文件,本地也不保留
git rm [file]
# 如果文件已经被提交
git rm -f [file]
# 删除git中文件,但是本地保留
git rm --cached [file]

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.