日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

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

發(fā)布時(shí)間:2025/6/17 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【Git】Git 分支管理 ( 解决分支合并冲突 | 创建并切换分支 git switch -c feature1 | 修改 feature1 分支并提交 | 修改 master 主版本并提交 ) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

文章目錄

  • 一、創(chuàng)建并切換分支 git switch -c feature1
  • 二、修改 feature1 分支并提交
  • 三、修改 master 主版本并提交





一、創(chuàng)建并切換分支 git switch -c feature1



執(zhí)行

git switch -c feature1

命令 , 創(chuàng)建分支 feature1 , 并切換到該分支 ;


執(zhí)行過程 :

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





二、修改 feature1 分支并提交



修改 feature1 中的 README.txt 文件內(nèi)容為 feature1 , 并執(zhí)行 git add README.txt 和 git commit -m "feature1" 命令提交到版本庫(kù) ;


執(zhí)行過程 :

D:\Git\git-learning-course>git switch -c feature1 Switched 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 文件內(nèi)容為 master , 并執(zhí)行 git add README.txt 和 git commit -m "feature1" 命令提交到版本庫(kù) ;


執(zhí)行過程 :

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.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 文件 , 兩個(gè)分支中的相同文件內(nèi)容不同 , 必然會(huì)導(dǎo)致沖突產(chǎn)生 ;

總結(jié)

以上是生活随笔為你收集整理的【Git】Git 分支管理 ( 解决分支合并冲突 | 创建并切换分支 git switch -c feature1 | 修改 feature1 分支并提交 | 修改 master 主版本并提交 )的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。