Git 常用命令速查

2021-09-25 14:19:06 字數 1657 閱讀 7024

git branch 檢視本地所有分支

git status 檢視當前狀態

git commit 提交 

git branch -a 檢視所有的分支

git branch -r 檢視遠端所有分支

git commit -am "init" 提交並且加注釋

git remote add origin [email protected]:ndshowgit push origin master 將檔案給推到伺服器上 

git remote show origin 顯示遠端庫origin裡的資源 

git push origin master:developgit push origin master:hb-dev 將本地庫與伺服器上的庫進行關聯

git checkout --track origin/dev 切換到遠端dev分支

git branch -d master develop 刪除本地庫

developgit checkout -b dev 建立乙個新的本地分支

devgit merge origin/dev 將分支dev與當前分支進行合併

git checkout dev 切換到本地dev分支

git remote show 檢視遠端庫

git add .git rm 檔名(包括路徑) 從git中刪除指定檔案

git clone git: 從伺服器上將**給拉下來

git config --list 看所有使用者

git ls-files 看已經被提交的

git rm [file name] 刪除乙個檔案

git commit -a 提交當前

repos的所有的改變

git add [file name] 新增乙個檔案到

git indexgit commit -v 當你用-v引數的時候可以看commit的差異

git commit -m "this is the message describing the commit" 新增commit資訊

git commit -a -a是代表add,把所有的change加到git index裡然後再commitgit commit -a -v 一般提交命令

git log 看你commit的日誌

git diff 檢視尚未暫存的更新

git rm a.a 移除檔案(從暫存區和工作區中刪除)

git rm --cached a.a 移除檔案(只從暫存區中刪除)

git commit -m "remove" 移除檔案(從git中刪除)

git rm -f a.a 強行移除修改後檔案(從暫存區和工作區中刪除)

git diff --cached 或 $ git diff --staged 檢視尚未提交的更新

git stash push 將檔案給push到乙個臨時空間中

git stash pop 將檔案從臨時空間pop下來

git pull -p   本地分支和遠端分支同步

# 等同於下面的命令

$ git fetch --prune origin 

$ git fetch -p

刪除本地分支

命令列 : $ git branch -d

刪除遠端分支

命令列 : $ git push origin --delete

Git 常用命令速查

記錄一下方面自己查詢 git branch 檢視本地所有分支 git status 檢視當前狀態 git commit 提交 git branch a 檢視所有的分支 git branch r 檢視遠端所有分支 git commit am init 提交並且加注釋 git remote add or...

Git 常用命令速查

git branch 檢視本地所有分支 git status 檢視當前狀態 git commit 提交 git branch a 檢視所有的分支 git branch r 檢視遠端所有分支 git commit am init 提交並且加注釋 git remote add origin git 19...

Git 常用命令速查

英文 含義master 預設開發分支 head 預設開發分支 origin 預設遠端版本庫 head head的父提交 注 此表引用自網際網路 2.修改和提交 3.檢視提交歷史 4.撤銷 5.分支與標籤 6.合併和衍合 7.遠端操作 1.1 轉殖遠端版本庫 git clone1.2 初始化本地版本庫...