Git 移動操作

來源:互聯網
上載者:User

標籤:tag   位置   files   目錄結構   ons   檔案   word   server   pad   

顧名思義移動(move )操作移動目錄或檔案從一個位置到另一個。Tom 決定移動到src目錄下的源代碼。因此,修改後的目錄結構看起來會像這樣。

[[email protected] project]$ pwd /home/tom/project

[[email protected] project]$ ls README string string.c

[[email protected] project]$ mkdir src

[[email protected] project]$ git mv string.c src/

[[email protected] project]$ git status -s R string.c −> src/string.c ?? string

要進行這些永久性更改,以便其他開發人員可以看到這一點,我們必須修改的目錄結構推到遠程存放庫。

[[email protected] project]$ git commit -m “Modified directory structure” [master 7d9ea97] Modified directory structure 1 files changed, 0 insertions(+), 0 deletions(-) rename string.c => src/string.c (100%)

[[email protected] project]$ git push origin master Counting objects: 4, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 320 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To [email protected]erver.com:project.git e86f062..7d9ea97 master −> master

在Jerry 的本地資產庫,抽取操作前,它會顯示舊的目錄結構。

[[email protected] project]$ pwd /home/jerry/jerry_repo/project [[email protected] project]$ ls README string string.c

但是,抽取(pull )操作後的目錄結構將得到更新。現在,Jerry 可以看到該目錄內的 src目錄和檔案。

[[email protected] project]$ git pull remote: Counting objects: 4, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From git.server.com:project e86f062..7d9ea97 master −> origin/master First, rewinding head to replay your work on top of it… Fast-forwarded master to 7d9ea97683da90bcdb87c28ec9b4f64160673c8a. [[email protected] project]$ ls README src string [[email protected] project]$ ls src/ string.c

PS:如果您想和業內技術大牛交流的話,請加qq群(521249302)或者關注公眾 號(AskHarries),謝謝!

Git 移動操作

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.