git分支合併,及衝突處理

2021-07-24 08:42:58 字數 1130 閱讀 6061

寫的有點亂,只是做了乙個總結

方法一:git checkout -b test

方法二:git branch test

git checkout test

git branch
git push origin test
git branch -d test
git push origin :test
顯示結果為:

*master

test

*代表當前所在的分支,說明在主分支master下

git branch --romote
第一步:先切換到master下面

git checkout master

第二部:git merge --no-ff test

合併分支時,可能遇到的問題:

auto merge failed; fix conflicts and then commit the result.
處理辦法:

檢視狀態:git status,提示要git add,git commit ,

一切完畢後,重新執行一次 git merge --no-ff test

git fetch

git checkout origin/master -- path/to/file

第一步:git reflog 

#檢視 commit日誌,找到commit id

第二部:git reset --hard id

#回退到某個版本下

首先:git pull

然後:git add ,git commit ,git push

首先:git merge branch 

然後:git add ,git commit ,git push

git 分支合併衝突處理(conflict)

基於同個原始分支後,兩個分支同步開發,最後合併 合併兩個分支 branch1 2可以是分支名,也可以通過指定版本的sha1 16進製制的前7個位 git merge branch1 branch2 解決衝突通過git diff來比較兩個分支的不同點,手動合併 比較兩個分支 預設比較所有的不同 git...

git分支合併及衝突解決

小明在愉快的敲 vim ok 他在ok裡敲了simachanping git commit am commit first version by xiaoming 然後這時他接到了產品的 說有乙個新需求要做名字是iss53,小明就打算新建乙個iss53分支來實現需求 git checkout b i...

git 分支合併 分支衝突

分支合併的不同使用場景 合併指定分支到當前分支 git merge 當多分枝協作時,往往會產生一些衝突 你的本地有兩個分支master dev,指向同乙個版本,起始時狀態相同,且只有乙個readme.txt檔案。你在master上新增一段hello master,且add git commit 然後...