【Git】Git 分支管理 ( 解决分支合并冲突 | 创建并切换分支 git switch -c feature1 | 修改 feature1 分支并提交 | 修改 master 主版本并提交 )
Git 解决 管理 版本 创建 修改 分支 切换
2023-06-13 09:18:00 时间
文章目录
一、创建并切换分支 git switch -c feature1
执行
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 分支并提交
修改 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 主版本并提交
修改 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 文件 , 两个分支中的相同文件内容不同 , 必然会导致冲突产生 ;
相关文章
- Git相关知识
- pycharm上传代码到gitlab_pycharm配置git
- git/github使用完整教程(1)基础
- 技术栈系列基础篇3-git
- (数据科学学习手札141)利用Learn Git Branching轻松学习git常用操作
- git 查看、修改Git用户名和密码_163邮箱用户名可以改吗
- Git分布式版本控制工具学习(八)
- git 报错Git fatal: Unknown index entry format xxxxx的错误解决方法
- git强制删除本地分支_Git分支
- 如何自建一个git服务器,搭建Git服务器,真的很简单
- Git使用流程_git提交流程
- 如何解决进行git合并造成的冲突详细的很
- [Git]Git Flow 工作原理
- 【错误记录】Git 使用报错 ( git branch -a 仍能查询到已经删除的远程分支 )
- git fatal detected dubious ownership in repository 的解决方法
- 使用git提交代码时发生冲突的解决方法
- git之解决每次拉取、提交代码时都需要输入用户名和密码详解程序员
- 学习Linux如何使用Git代码版本管理(linux使用git)
- Linux下的Git版本控制管理实战(linux的git)
- 使用Git在Linux系统中管理代码(linux中的git命令)
- Linux内核管理:Git的力量(linux内核git)
- 安装linux下Git安装指南(linux下git)
- 安装Git服务器:在Linux环境下的步骤(linux安装git服务器)
- Linux下使用Git的快速安装步骤(linux下git的安装)
- Linux下安装Git的指引(在linux下安装git)