Git移除版本控制操作__Git移除版本控制操作

來源:互聯網
上載者:User

一、使用git rm 命令

1.預覽要刪除的檔案

執行 git rm -r -n --cached "bin/"   ,此命令是展示要刪除的檔案表預覽

2.移除版本控制操作

執行 git rm -r --cached  "bin/"     ,刪除檔案的命令. 執行 git commit -m" 刪除bin檔案"    ,提交,並加註釋執行 git push origin master      ,提交到遠程伺服器

註:此刪除保留本地檔案,如果刪除伺服器檔案可以不使用推送。


當我們需要刪除暫存區或分支上的檔案, 同時工作區也不需要這個檔案了, 可以使用

1 git rm file_path2 git commit -m 'delete somefile'3 git push

當我們需要刪除暫存區或分支上的檔案, 但本地又需要使用, 只是不希望這個檔案被版本控制, 可以使用

git rm --cached file_pathgit commit -m 'delete remote somefile'git push

更多:

git回到指定版本命令

使用Git擷取最新版本到本地

刪除github上的遠程分支

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.