Git常用命令

2021-09-01 02:33:51 字數 1129 閱讀 7912

1、 git branch 顯示所有本地分支。

2、 git branch –a顯示所有分支(包括遠端和本地)。

3、 git branch -r命令為顯示所有遠端分支。前面有*號的,為當前所在分支。

4、 git checkout -b 「new-branch-name」新建分支。

例如: ***/hotfix_cloud_billing (develop)$ git checkout -b test

5、 git checkout branch-name切換分支。

6、 git merge 「another-branch」合併分支**到當前分支。

例如:***/hotfix_cloud_billing (develop)$ git merge hotfix

7、 git branch -d 「branch-name」 刪除分支。

例如: ***/hotfix_cloud_billing (develop)$ git branch -d reserve

***/hotfix_cloud_billing (reserve)$ git branch -d reserve

error: cannot delete branch 『reserve』 checked out at 『***/hotfix_cloud_billing』

8、 git status檢視當前狀態,該命令會顯示有哪些檔案是新新增的,還有哪些沒有提交等資訊。

9、 git add 新增待本地倉庫 .新增當前目錄的所有未新增的檔案,也可以指定某個檔案。

10、git commit -m 「注釋」 **提交。使用該命令進行提交到**倉庫中。並注釋此次新增的內容推送到遠端倉庫。

11、git push origin推送到遠端倉庫。

12、git log顯示提交日誌。顯示提交日誌,其中包括提交使用者名稱,提交時間等。

13、git tag tag-name打標籤,上線完成後,打個tag標記。

14、git push origin brancha:brancha 推送新建分支到遠端git倉庫。

15、git pull origin brancha:brancha 首次更新新建分支的**。

16、git remote set-url origin 「git url」 git 遷移。

常用命令 Git 常用命令大全

安裝教程可參照 廖雪峰老師的安裝教程。git config 在git中,使用git config 命令來配置 git 的配置檔案,git配置級別主要有3類 1 倉庫級別 local 本地 git 倉庫級別配置檔案,作用於當前倉庫。優先順序最高 2 使用者級別 global,全域性配置檔案,作用於所有...

git 常用命令

檢視是否存在檔案需要上傳 git status git add git commit m 建立遠端倉庫 git remote add origin 116.255.146.153 ruby cd work daily project.git 更新git fetch 116.255.146.153 r...

git常用命令

詳細 1,git log p 命令來顯示每一次提交與其父節點提交內容之間快照的差異。2,為了檢視載入 staged 而並未提交 not committed 的內容差異,可以使用 git diff stage 命令 在git 1.6之前的版本中,使用 cached 適應情形 在執行git commit...