执行
git switch -c feature1
命令 , 创建分支 feature1 , 并切换到该分支 ;
执行过程 :
D:\Git\git-learning-course>git switch -c feature1
Switched to a new branch 'feature1'
D:\Git\git-learning-course>
修改 feature1 中的 README.txt 文件内容为 feature1 , 并执行 git add README.txt
和 git commit -m "feature1"
命令提交到版本库 ;
执行过程 :
D:\Git\git-learning-course>git switch -c feature1
Switched to a new branch 'feature1'
D:\Git\git-learning-course>git add README.txt
D:\Git\git-learning-course>git commit -m "feature1"
[feature1 26b1978] feature1
1 file changed, 1 insertion(+), 1 deletion(-)
修改 master 中的 README.txt 文件内容为 master , 并执行 git add README.txt
和 git commit -m "feature1"
命令提交到版本库 ;
执行过程 :
D:\Git\git-learning-course>git switch master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
D:\Git\git-learning-course>git add README.txt
D:\Git\git-learning-course>git commit -m "master"
[master c9842ef] master
1 file changed, 1 insertion(+), 1 deletion(-)
D:\Git\git-learning-course>git branch
feature1
* master
上述操作的目的是 , 在 master 分支中修改 README.txt 文件 , 在 feature1 分支中修改 README.txt 文件 , 两个分支中的相同文件内容不同 , 必然会导致冲突产生 ;
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有