Git 常用命令速查

2021-07-22 07:02:25 字數 2109 閱讀 2095

記錄一下方面自己查詢

git branch 檢視本地所有分支

git status 檢視當前狀態

git commit 提交

git branch -a 檢視所有的分支

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

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

git remote add origin [email protected]:ndshow

git push origin master 將檔案給推到伺服器上

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

git push origin master:develop

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

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

git branch -d master develop 刪除本地庫develop

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

git 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 index

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

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

git commit -a -a是代表add,把所有的change加到git index裡然後再commit

git 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 remote add origin [email protected]:username/hello-world.git

git push (遠端倉庫名) (分支名) 將本地分支推送到伺服器上去。

git fetch 相當於是從遠端獲取最新版本到本地,不會自動merge

git commit -a -m 「log_message」 (-a是提交所有改動,-m是加入log資訊) 本地修改同步至伺服器端 :

git branch branch_0.1 master 從主分支master建立branch_0.1分支

git branch -m branch_0.1 branch_1.0 將branch_0.1重新命名為branch_1.0

git checkout branch_1.0/master 切換到branch_1.0/master分支

du -hs

git branch 刪除遠端branch

git push origin :branch_remote_name

增加乙個遠端伺服器端

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 初始化本地版本庫...

Git 常用命令速查

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