试图模拟 git 合并冲突
Trying to simulate a git merge conflict
我正在尝试模拟一个简单的合并冲突,在网站上阅读了类似的任务,我的情况略有不同。
这是我正在执行的步骤。
我有开发分支
从开发分支创建 Branch1
从开发分支创建 Branch2
对 Branch1 进行了更改,暂存并提交更改。
对 Branch2 进行了更改,暂存并提交更改。
在签出 Branch1 时,运行 命令 git 合并 origin/Branch1
我收到消息
git merge origin/feature/Branch1
Already up to date.
我不确定我在这里做错了什么,开发分支的设置方式,提交只能通过拉取请求进行,如果我可以说明 git 冲突而不需要拉取请求,那会简单得多。
[git merge
] Incorporates changes from the named commits (since the time their histories diverged from the current branch) into the current branch. This command is used by git pull to incorporate changes from another repository and can be used by hand to merge changes from one branch into another.
[...]
Then git merge topic
will replay the changes made on the topic
branch since it diverged from master
为了使这个命令生效,移动到 develop 分支,然后再次尝试合并。
模拟可能无法运行的几个原因:
你正在做的是从原点合并。
在您的步骤中,您没有推送任何内容,因此不会有任何与您当前分支冲突的 origin 更新。
相反,(在这个模拟案例中)从您的本地分支合并,以获得最新更新。
你做了什么改变?
您需要确保更改同一文件中的相同行以触发冲突。
确保合并正确的分支。
如果合并branch1
和origin/branch1
,在这个模拟中,不会有任何冲突。
我正在尝试模拟一个简单的合并冲突,在网站上阅读了类似的任务,我的情况略有不同。
这是我正在执行的步骤。
我有开发分支
从开发分支创建 Branch1
从开发分支创建 Branch2
对 Branch1 进行了更改,暂存并提交更改。
对 Branch2 进行了更改,暂存并提交更改。
在签出 Branch1 时,运行 命令 git 合并 origin/Branch1 我收到消息
git merge origin/feature/Branch1
Already up to date.
我不确定我在这里做错了什么,开发分支的设置方式,提交只能通过拉取请求进行,如果我可以说明 git 冲突而不需要拉取请求,那会简单得多。
[
git merge
] Incorporates changes from the named commits (since the time their histories diverged from the current branch) into the current branch. This command is used by git pull to incorporate changes from another repository and can be used by hand to merge changes from one branch into another.[...]
Then
git merge topic
will replay the changes made on thetopic
branch since it diverged frommaster
为了使这个命令生效,移动到 develop 分支,然后再次尝试合并。
模拟可能无法运行的几个原因:
你正在做的是从原点合并。 在您的步骤中,您没有推送任何内容,因此不会有任何与您当前分支冲突的 origin 更新。 相反,(在这个模拟案例中)从您的本地分支合并,以获得最新更新。
你做了什么改变? 您需要确保更改同一文件中的相同行以触发冲突。
确保合并正确的分支。 如果合并
branch1
和origin/branch1
,在这个模拟中,不会有任何冲突。