好像在Day07的樣子吧((沉思
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
$ ls
123.txt Hello.txt
$ mkdir test-dir
$ ls
123.txt Hello.txt test-dir
test-dir
嘛!git status
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
$ cd test-dir
$ vim test.txt
$ cd ..
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
test-dir/
nothing added to commit but untracked files present (use "git add" to track)
沒錯,曾經有個可愛的同學跑來這樣問我
他一個不小心把所有檔案都給刪掉了XD
現在,讓我們來模擬一下他的情況吧~~
在資料夾裡面,假設有三個.txt
的檔案,我們用指令將它給刪除掉吧!
$ ls
123.txt 456.txt 789.txt
$ rm *.txt
$ git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: 123.txt
deleted: 456.txt
deleted: 789.txt
no changes added to commit (use "git add" and/or "git commit -a")
status
裡面有我們剛剛刪掉的東西呀git checkout
!!!$ git checkout 123.txt
Updated 1 path from the index
$ git checkout .
Updated 2 paths from the index
.txt
的檔案都給救回來今天先到這邊啦~~ 明天在繼續我們的狀況處哩!