# 4 Q&A {%hackmd 1lpg7PuqRoaui6XyJcrylw %} ### 若不小心改到內容,且不小心add過了,想退回上次的commit怎麼辦? 1. 先下指令 ==git reset HEAD \<file>== 來還原 "檔案狀態" 可以只下==git reset HEAD==此時你的檔案狀態會回到前一個狀態,如下圖(是不小心改動後,又不小心做了`git add`的狀況):  因此下了指令後,檔案會從stage狀態(Changes to be commit)回到unstage狀態  2. 接著下==git checkout \-\- \<file>== 來還原 "檔案內容" :::info :bulb: 意思是捨棄檔案的修改,回到最近一次commit時的樣子。 ::: 下完指令後,使用==git status==會如下圖  :::info :heart: 忘記指令可以參考`git status`中提示指令。 :link: 參考資料網址,裡面也有解釋上述兩個指令的用途 https://zlargon.gitbooks.io/git-tutorial/content/file/recover.html ::: ### 如何查詢我現在的container ID是使用哪個image? 1.先使用==docker ps -a==,確認你現在的container ID 2.再使用==docker inspect <你的container ID>== 如下圖,去找Image的部分。  或者直接使用`docker inspect -f {{.Image}} <你的container ID>`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up