git 分支 branch操作彙總

2021-10-06 11:24:42 字數 867 閱讀 9985

git branch test:基於當前commit 建立test分支, .git/head 檔案中記錄了當前分支的名字

git branch -d test: 刪除本地test分支

git branch -d test: test分支還沒有合入當前分支,所以要用-d引數才能刪掉

git push origin --delete test: 刪除遠端test分支

git push origin :test: 刪除遠端test分支

git branch: 列出當前分支清單

git branch -a: 檢視遠端分支和本地分支

git branch -v: 檢視各個分支最後乙個提交資訊

git branch --merged: 檢視哪些分支已經合併入當前分支

git fetch origin: 同步遠端伺服器的資料到本地

git checkout -b test origin/test_remote: 將遠端分支 test_remote 拉取下來到本地test分支

git checkout test: 將遠端分支test拉取下來到本地test分支

git pull test: 從遠端分支test中 checkout下來的本地分支test成為跟蹤分支,使用git pull或者git push就會操作到對應的遠端分支 test

git 分支 branch 操作

建立分支 git branch test 基於當前commit建立test分支。git head 檔案中記錄了當前分支名字。刪除分支 git branch d test 刪除本地test分支 git branch d test test分支還沒有合入當前分支,所以要用 d引數才能刪掉。git pus...

分支操作 branch

分支操作 檢視分支 git branch v建立分支 git branch one branch git branch 分支名 切換分支 git checkout one branch git checkout 分支名 合併分支 例 假如one branch 分支修改完成,我將其與master合併 ...

Git的實戰操練 分支branch

系統上線了,但是產品經理又提了新的需求,評估一下工期要兩個月,但是同時系統正在上線執行,時不時還要修改bug,如何管理幾個版本?建立分支 git branch 分支 檢視分支 git branch v 切換分支 git checkout 分支 一步完成 git checkout b 分支 合併分支 ...