我在开发中有一个名为“dmgr2”的分支,我想从主分支(活动站点)中提取并将所有更改合并到我的开发分支中。有更好的方法吗?

以下是我在提交更改后的计划:

git checkout dmgr2
git pull origin master

这应该会将实时更改拉入我的开发分支,还是我错了?


当前回答

这是我的解决方案:

git checkout mybranch
git rebase master mybranch
git add .
git rebase --continue
git commit -a -m "test"
git pull
git push

使用gitadd。以暂存文件。

下面是另一个解决方案,用于将主更改添加到分支:

git checkout mybranch
git fetch origin
git merge origin/master

当您使用rebase时,您的git历史很清楚,但使用mergeorigin/master更容易。

其他回答

如果开发是干净的,并且只想使用主或主更改进行更新

git结帐设备git拉动原点<main或master>git推送原始设备

首先,使用以下方法获取代码:git获取然后使用:git rebase origin/dev

我有主更新和我的分支更新,我希望我的分支通过重新基址来跟踪主,以正确跟踪所有历史记录。让我们把我的分支叫做Mybranch:

git checkout master
git pull --rebase
git checkout Mybranch
git rebase master
git push -f origin Mybranch

我需要根据情况和git提示,使用git mergetool、git rebase--continue、git re base--skip和git add-u解决所有冲突,直到所有问题都得到解决。

注意:在Tzachi Cohen的帮助下,对最后一个阶段进行了更正,使用“-f”强制git在服务器上“更新历史记录”。

现在,分支应该与master和re-based对齐,也应该与远程更新对齐,所以在git日志中没有“后面”或“前面”,我只需要删除所有本地冲突*.orig文件以保持文件夹“干净”。

这是我的解决方案:

git checkout mybranch
git rebase master mybranch
git add .
git rebase --continue
git commit -a -m "test"
git pull
git push

使用gitadd。以暂存文件。

下面是另一个解决方案,用于将主更改添加到分支:

git checkout mybranch
git fetch origin
git merge origin/master

当您使用rebase时,您的git历史很清楚,但使用mergeorigin/master更容易。

在我的本地分支机构工作,我喜欢在名为dev的开发分支机构中保持更新。

通常,我更喜欢使用:

git fetch
git rebase origin/dev