git 小白入门手及把手使用教程,看了之后我终于明白了

本文分享了作者在日常使用Git过程中对于缓存区文件管理的心得体会,包括如何查看缓存区文件状态,以及如何精准地移除缓存区中不再需要的文件,而不删除本地文件,为读者提供了实用的Git操作指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

说明

本文记录本人平时使用 git 的记录和心得。

移除缓存区的不要的文件、且不删除本地文件

git status 查看缓冲区文件

(NLP) D:\Project\SeleniumProxy>git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   .gitignore
        new file:   .idea/.gitignore
        new file:   .idea/SeleniumProxy.iml
        new file:   .idea/deployment.xml
        new file:   .idea/encodings.xml
        new file:   .idea/inspectionProfiles/profiles_settings.xml
        new file:   .idea/misc.xml
        new file:   .idea/modules.xml
        new file:   .idea/vcs.xml
        new file:   __pycache__/ip.cpython-37.pyc
        new file:   __pycache__/tools.cpython-37.pyc
        modified:   iplib/ip.txt
        new file:   push.bat

git rm -r --cached 移除目录中的文件

(NLP) D:\Project\SeleniumProxy>git rm -r .idea --cached
rm '.idea/.gitignore'
rm '.idea/SeleniumProxy.iml'
rm '.idea/deployment.xml'
rm '.idea/encodings.xml'
rm '.idea/inspectionProfiles/profiles_settings.xml'
rm '.idea/misc.xml'
rm '.idea/modules.xml'
rm '.idea/vcs.xml'

git status 再次查看,发现没了

(NLP) D:\Project\SeleniumProxy>git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   .gitignore
        new file:   __pycache__/ip.cpython-37.pyc
        new file:   __pycache__/tools.cpython-37.pyc
        modified:   iplib/ip.txt
        new file:   push.bat
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值