Git 刪除操作

2021-09-07 07:18:15 字數 1274 閱讀 8647

tom 更新了自己的本地儲存庫並進入src目錄下找到編譯後的二進位制。檢視提交資訊後,他意識到,編譯後的二進位制是由jerry加入的。 .

[tom@centos src]$ pwd /home/tom/project/src [tom@centos src]$ ls makefile string_operations string_operations.c [tom@centos src]$ file string_operations string_operations: elf 64-bit lsb executable, x86-64, version 1 (sysv), dynamically linked (uses shared libs), for gnu/linux 2.6.18, not stripped [tom@centos src]$ git log commit 29af9d45947dc044e33d69b9141d8d2dad37cc62 author: jerry mouse date: wed sep 11 10:16:25 2013 +0530 added compiled binary

vcs用於儲存源**,而不是只對可執行的二進位制檔案。因此,tom 決定從資源庫中刪除此檔案。對於進一步的操作,他使用git 的 rm命令。

[tom@centos src]$ ls makefile string_operations string_operations.c [tom@centos src]$ git rm string_operations rm 『src/string_operations』 [tom@centos src]$ git commit -a -m 「removed executable binary」 [master 5776472] removed executable binary 1 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 src/string_operations

提交後,他推送了他的修改到版本庫。

[tom@centos src]$ git push origin master

上面的命令會產生以下結果。

counting objects: 5, done. compressing objects: 100% (3/3), done. writing objects: 100% (3/3), 310 bytes, done. total 3 (delta 1), reused 0 (delta 0) to [email protected]:project.git 29af9d4..5776472 master −> master

git刪除 撤銷操作

首先簡單說一下git的三個區 工作區 可以相當於是我們的本地的資料夾,本地倉庫 版本庫 工作區有個.git隱藏資料夾,記錄著版本 暫存區 版本庫的乙個重要部分,工作區到版本庫的過程中,需要經過暫存區 在進行git操作時,經常會有一些誤操作 在這裡總結一些補救的方法 一 刪除錯誤新增到暫存區的檔案 g...

git檔案刪除操作

轉 比如,專案的控制檔案,一般是不上傳的,現在我使用webstorm,它的.idea目錄,有時候會錯誤的上傳到遠端庫中。刪除的步驟如下。將本地.idea目錄改名,這個步驟適合於不是你push該目錄,是別人上傳的 mv idea idea back 如果是自己push的,可略過上面步驟。刪除.idea...

git操作基礎 刪除資料夾

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!項番命令 no.1 git rm rf 資料夾名 no.2 git add a no.3 git commit m delete dir no.4 git push root host31 src git rm rf staticrm src st...