Git处理跟踪文件和未跟踪文件的合并冲突

时间:2018-09-05 15:11:24

标签: git merge-conflict-resolution

我在这个develop分支中,我结帐到新的本地分支以开发新功能。

git checkout -b task-change-title-and-styling

然后,我进行了一些代码更改,现在我同时拥有trackeduntrack文件。

我知道不会发生合并冲突的常见做法如下:

git add .
git commit -m "Change titles and styling on homepage"
git fetch origin
git rebase origin/develop
git push -u origin task-change-title-and-styling

完成。

现在在新情况下,我知道我的更改将与其他更改冲突,我该怎么办(假设我同时拥有trackeduntracked文件)?

以下只是我处理合并冲突的假设,但不确定步骤是否正确

git add .
git commit -m "Change titles and styling on homepage"
git fetch origin
git rebase origin/develop

*at this point i assume my git will have merge conflict message*

然后我解决合并冲突,然后执行

git add .
git rebase --continue
*there are still conflict message*

再次修改代码,然后执行

git add .
git rebase --continue
*now no more merge conflict message*
git push -u origin task-change-title-and-styling  

1 个答案:

答案 0 :(得分:1)

您的假设是正确的。 虽然,我从不使用git fetch origin来进行rebase,因为git gebase origin / develop已经开始提取最新版本的development分支