常用git命令集

來源:互聯網
上載者:User

標籤:style   http   color   ar   for   檔案   sp   div   on   

//建立本地倉庫mkdir git_root;cd git_root;git init ////查看git status .git loggit log ./kernel/driver/git show 17228ec1630f6b47983870b3eddc90d4088dcc88 --name-only//下載 
git clone https://github.com/wh19910525/my_often_shell.git git branchgit branch -agit checkout branch1 //switch to an local branchgit checkout -t remot_branch2 //download and switch to an remote branchgit checkout /kernel/driver/ //將指定目錄下的檔案還原成伺服器上的內容
//提交git add .git commit -m "this my first commit"git pullgit push//恢複修改git checkout -- hardware/realtek/rtl_8723bs/8723bs.mod.c //discard this filesgit reset //產生補訂git format-patch -1 hash // git format-patch -1 300830d0286bceca191d926bc2cf4d08cc58b813   git diff drivers/idle/intel_idle.c > liuxd_test_patchgit am xx.patchpatch -p1 < test1.patch // a/該目錄patch -p2 < test1.patch // a/b/該目錄建立分支//new branchgit branch // listgit branch my_new_branch //  add a new branch at localgit checkout my_new_branch // switch to local branchgit push origin my_new_branch:my_new_branch //push to remote server.
//git revert 9ca532610fa179911b23e244c96db10c140639f2 // 取消某次提交

//git checkout . // 還原(覆蓋)本地的修改
//git cherry-pick  9ca532610fa179911b23e244c96db10c140639f2  //將遠程分支對應的補丁打過來。git clean -df //delete所有未跟蹤的目錄及檔案

刪除分支: 
1 刪除遠程分支 
$ git push origin :branchName 
2 刪除本地分支,強制移除用-D 
$ git branch -d branchName

常用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.