git 合並代碼


合並代碼

git status 查看狀態

image-20210602163408145

解決modified

image-20210602164307556

image-20210602164242711

第一步

切換到和合並的分支

git checkout master

image-20210602163452190

拉取分支的代碼

git pull

image-20210602163548577

解決沖突

git merge 本地分支(new_dev_zg)

image-20210602163635625

pycharm 解決沖突

image-20210602164520984

image-20210602164557221

解決完沖突之后提交代碼

git add.
git commit -m"注釋"
git push

image-20210602163800592

出現error 是因為git 權限的問題

然后反過來主分支合並本地分支解決沖突

image-20210602163922986

操作

一、git 如何把分支代碼合並到master

1.首先切換到分支;

git checkout hellomonkey
2.使用git pull 把分支代碼pull下來;

git pull
3.切換到主分支;

git checkout master
4.把分支的代碼merge到主分支;

git merge hellomonkey
5.git push推上去ok完成,現在 你自己分支的代碼就合並到主分支上了。

git push
總結:同樣的道理,主分支的文件也可以合並的分支上。

二、git 如何把master分支代碼合並到自己的分支
master分支的代碼領先自己的分支,git 如何把master分支代碼合並到自己的分支

1.首先切換到主分支

git checkout master

2.使用git pull 把領先的主分支代碼pull下來

git pull

3.切換到自己的分支

git checkout xxx(自己的分支)

4.把主分支的代碼merge到自己的分支

git merge master

5.git push推上去ok完成,現在 你自己分支的代碼就和主分支的代碼一樣了

git push origin 自己分支名


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM