每天一个Git 知识

一图顶千言

1.  工作区内容有修改,还没有add,如果想撤销修改,用命令

git restore <file>...

On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   71.txt

2.  工作区内容有修改,并且add 进入了暂存区,想撤销修改

先用

git restore --staged 71.txt

这样回到工作区

再用

git restore <file>...

3.  工作区间内容有变化,并且没有add ,如何删除

On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
    8.txt

git clean 谨慎使用

git clean --->移除工作区的改动、新增、删除

git clean -f <path>

删除指定路径下的没有被track过的文件

git clean -df

删除当前目录下没有被track过的文件和文件夹

使用过程如下所示:

git clean -df

Removing 8.txt


git status

On branch master
nothing to commit, working tree clean
 


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值