700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 【Git】Git 分支管理 ( 解决分支合并冲突 | 创建并切换分支 git switch -c f

【Git】Git 分支管理 ( 解决分支合并冲突 | 创建并切换分支 git switch -c f

时间:2020-02-11 07:41:01

相关推荐

【Git】Git 分支管理 ( 解决分支合并冲突 | 创建并切换分支 git switch -c f

文章目录

一、创建并切换分支 git switch -c feature1二、修改 feature1 分支并提交三、修改 master 主版本并提交

一、创建并切换分支 git switch -c feature1

执行

git switch -c feature1

命令 , 创建分支 feature1 , 并切换到该分支 ;

执行过程 :

D:\Git\git-learning-course>git switch -c feature1Switched to a new branch 'feature1'D:\Git\git-learning-course>

二、修改 feature1 分支并提交

修改 feature1 中的 README.txt 文件内容为 feature1 , 并执行git add README.txtgit commit -m "feature1"命令提交到版本库 ;

执行过程 :

D:\Git\git-learning-course>git switch -c feature1Switched to a new branch 'feature1'D:\Git\git-learning-course>git add README.txtD:\Git\git-learning-course>git commit -m "feature1"[feature1 26b1978] feature11 file changed, 1 insertion(+), 1 deletion(-)

三、修改 master 主版本并提交

修改 master 中的 README.txt 文件内容为 master , 并执行git add README.txtgit commit -m "feature1"命令提交到版本库 ;

执行过程 :

D:\Git\git-learning-course>git switch masterSwitched 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.txtD:\Git\git-learning-course>git commit -m "master"[master c9842ef] master1 file changed, 1 insertion(+), 1 deletion(-)D:\Git\git-learning-course>git branchfeature1* master

上述操作的目的是 , 在 master 分支中修改 README.txt 文件 , 在 feature1 分支中修改 README.txt 文件 , 两个分支中的相同文件内容不同 , 必然会导致冲突产生 ;

【Git】Git 分支管理 ( 解决分支合并冲突 | 创建并切换分支 git switch -c feature1 | 修改 feature1 分支并提交 | 修改 master 主版本并提交 )

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。