git 常用命令

2021-07-25 08:54:32 字數 1930 閱讀 4078

有重複的命令,執行結果是一樣的

1.檢視遠端分支

git branch -a
2.檢視本地分支

git branch
3.建立分支

git branch test
4.切換分支

git checkout test
5.刪除本地分支

git branch -d test
6.刪除遠端分支

git push origin --delete 

7.初始化倉庫

git init
8.拉取遠端倉庫到本地

git clone [url]
9.關聯遠端倉庫

git remote add [remote-name] [url]
10.新增所有檔案

git add .
11.提交到本地倉庫和add配合使用

git commit -m "注釋"
12.撤銷最近的乙個提交

git revert head
13.將本地**提交到遠端倉庫

git push [remote-name] [loca-branch]:[remote-branch]
14.更新遠端倉庫

git pull [remote-name] [loca-branch]:[remote-branch]
15.合併分支

git merge [remote-name]/[branch]
16.檢視當前本地倉庫的所有分支

git branch
17.建立乙個新分支

git branch (branch name)
18.刪除乙個分支

git branch -d(branch-name)
19.刪除遠端倉庫的某個分支

git push (remote-name) :(remote-branch)
20.切換到某乙個分支

git checkout [branch-name]
21.建立並切換分支

git checkout -b [branch-name]
22.檢視操作日誌

git log

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