【发布时间】:2015-03-01 04:39:57
【问题描述】:
我有一个本地 git 存储库,我运行以下命令:
git.exe pull -v --no-rebase --progress "origin" // pull 1
(make a few local commits)
git.exe pull -v --no-rebase --progress "origin" // pull 2
git log --pretty=format:"%h - %an : %s" // log 1
git rebase -i HEAD~4
(move local commit 1 down 2 positions)
git log --pretty=format:"%h - %an : %s" // log 2
git.exe pull -v --no-rebase --progress "origin" // pull 3
git log --pretty=format:"%h - %an : %s" // log 3
完成此操作后,我在 pull 1 中检索到的远程存储库的所有提交现在都在日志中重复了。
日志 1 如下所示:
84e4015 - Me : Local Commit 3
0dbe86a - Me : Local Commit 2
d57ba2a - Me : Merge branch 'master' of remote repository
a86ea35 - Me : Local Commit 1 before reordering
2fc4fe7 - Remote User 2 : Remote Commit 2
b7a8656 - Remote User 1 : Remote Commit 1
8ce80fc - Me : Merge branch 'master' of remote repository
日志 2 如下所示:
cf1ff7b - Me : Local Commit 3
cd14463 - Me : Local Commit 2
b9d44fb - Me : Local Commit 1 after reordering
9777c56 - Remote User 2 : Remote Commit 2
a2d7d8b - Remote User 1 : Remote Commit 1
8ce80fc - Me : Merge branch 'master' of remote repository
日志 3 看起来像这样:
e8e1a85 - Me : Merge branch 'master' of remote repository
cf1ff7b - Me : Local Commit 3
cd14463 - Me : Local Commit 2
b9d44fb - Me : Local Commit 1 after reordering
9777c56 - Remote User 2 : Remote Commit 2
a2d7d8b - Remote User 1 : Remote Commit 1
2fc4fe7 - Remote User 2 : Remote Commit 2 // duplicate 2
b7a8656 - Remote User 1 : Remote Commit 1 // duplicate 1
8ce80fc - Me : Merge branch 'master' of remote repository
我做错了什么?我该如何预防?我该如何解决?
请注意,我从未推送到远程存储库,只是从中提取并进行本地提交。另请注意,这个问题有很多类似标题的主题,但它们都有点不同,那里的答案似乎不适用于这里。
【问题讨论】:
标签: git duplicates rebase pull