如何在不洗掉 github 中的舊提交的情況下推送包含檔案的檔案夾?
我已經上傳了一些檔案到 git 但接下來我上傳了另一個檔案。舊檔案被洗掉
uj5u.com熱心網友回復:
當想要嘗試通過執行push您不應該運行的操作來更新您的存盤庫時git remote add origin 'url_name',實際上嘗試運行此命令會導致我出現此錯誤:
*:\***> git remote add origin 'url.git'
error: remote origin already exists.
git remote add origin 'url_name' 將遠程添加到 Git 存盤庫,這就是它洗掉“舊”檔案的原因。
要更新您的存盤庫并保留您的“舊”檔案,請使用以下命令:
git status
git add .
git commit -m "update"
git push origin branch_name
在你的情況下branch_name是master. 讓我知道它是否對您有用以及它是否確實接受了答案:)
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/386574.html
