SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master) $ git status 【由於工作區文件被修改了,所以顯示為紅色】 On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: ihr-producer/src/main/resources/spring/applicationContext-producer.xml no changes added to commit (use "git add" and/or "git commit -a") SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master) $ git add . SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master) $ 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) modified: ihr-producer/src/main/resources/spring/applicationContext-producer.xml SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master) $ git reset HEAD . Unstaged changes after reset: M ihr-producer/src/main/resources/spring/applicationContext-producer.xml SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master) $ git status 【由於使用"git reset HEAD ."又撤銷了前面所做的所有的add操作,所以這里又恢復到紅色】 On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: ihr-producer/src/main/resources/spring/applicationContext-producer.xml no changes added to commit (use "git add" and/or "git commit -a") SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master) $ git checkout . 【撤銷對工作區所做的一切更改,這樣以前所有的修改就都沒有,慎用!】 SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master) $ git status On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master) $
如果覺得本文對您有幫助,不妨掃描下方微信二維碼打賞點,您的鼓勵是我前進最大的動力:

