Try   HackMD

使用git 刪除一個在repo上面的檔案

狀況

檔案已上傳github,發現裡面有不要的檔案,學習用git 刪除

cd到目的地資料夾
開啟vscode 打開要刪除檔案的folder,勇敢的把它刪掉

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

回到iterm 輸入git status 確認狀態,確定他已經被刪除了

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

git add .把所有檔案(更新後)加上repo並透過git status再次確認狀態由

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  1. 使用commit 輸入git commit -m "delete file(動詞+名詞)" (" "內盡量避免只有一動詞)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  1. 最後在push 上去,輸入git push
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

successful!
心得:感謝luka在直播手把手的教學,今天光這個問題應該困惱了一個小時,雖然只是對git使用的不熟悉,但我這一步一步在腦子印象深刻,git的基礎遭做還是要再加強。

tags: git