Git的restore

说明

   git restore 文件名字    进行清除工作区的改变

   同git chechout 文件名字    的作用是一样的;

   与git add .的作用相反

代码

Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (eeee)
$ git status
On branch eeee
Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git restore ..." to discard changes in working directory)
        modified:   PHPmesslayui/common/config.php

no changes added to commit (use "git add" and/or "git commit -a")

Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (eeee)
$ git checkout PHPmesslayui/common/config.php
Updated 1 path from the index

Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (eeee)
$ git status
On branch eeee
Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git restore ..." to discard changes in working directory)
        modified:   PHPmesslayui/common/config.php

no changes added to commit (use "git add" and/or "git commit -a")

Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (eeee)
$ git restore  PHPmesslayui/common/config.php

Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (eeee)
$ git status
On branch eeee
nothing to commit, working tree clean

Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (eeee)
$

 

你可能感兴趣的:(Git)