所以我一直在尝试使用以下post-commit
挂钩让我的gh-pages
分支与master保持同步:
#!/bin/sh
git checkout gh-pages
git rebase master
git checkout master
根据建议here
这是我的git lg
命令的一些输出(这是我在SO的某个地方发现的,感谢发布它的人)
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
它在终端中产生了一个很好的可读转储:
* 463703d - (HEAD, gh-pages) Merge branch 'gh-pages' of github.com:unphased/ply into gh-pages (2 minutes ago) <Ste
|\
| * ef1a304 - (origin/gh-pages) Merge branch 'gh-pages' of github.com:unphased/ply into gh-pages (8 minutes ago) <
| |\
| | * 2d0c8a1 - Merge branch 'gh-pages' of github.com:unphased/ply into gh-pages (26 minutes ago) <Steven Lu>
| | |\
| | | * 840df78 - Merge branch 'master' into gh-pages (68 minutes ago) <Steven Lu>
| | | |\
| | | * \ 7db37cc - Merge branch 'master' into gh-pages (7 hours ago) <Steven Lu>
| | | |\ \
| | | * | | 17f3dbc - Create gh-pages branch via GitHub (24 hours ago) <Steven Lu>
| | | / /
| | * | | 48bdf22 - Create gh-pages branch via GitHub (31 minutes ago) <Steven Lu>
| * | | | d15c161 - Create gh-pages branch via GitHub (9 minutes ago) <Steven Lu>
* | | | | 7024a62 - Create gh-pages branch via GitHub (4 minutes ago) <Steven Lu>
* | | | | f61b62d - (master) hopefully stuff calms down (4 minutes ago) <Steven Lu>
|/ / / /
* | | | 05c26a5 - (origin/master, origin/HEAD) some more progress (9 minutes ago) <Steven Lu>
|/ / /
* | | 20c6bdb - some progess on the touchmove event handler finally. hopefully this one will run the post-commit hoo
* | | d1ab53e - commented out touchmove log.. testing the auto-rebase on gh-pages (45 minutes ago) <Steven Lu>
| |/
|/|
* | 15fe88d - small update to js (70 minutes ago) <Steven Lu>
|/
* 6b5ee18 - updating note about mutation events' (7 hours ago) <Steven Lu>
* 1b43564 - okay now about ready to start assembling offsets. [snip]
历史的其余部分非常无趣(here是一个github网络图表示,可能稍微不那么头疼),我希望保留新位(gh-pages
的更新)也是无趣的,但我现在很清楚,如果rebase
正确发生,那么正在发生的非快进合并正在发生。
所以,因为我完全不知道在什么时候开始诊断rebase发生时出错的问题我将向你展示我最后一次提交的输出,这就产生了这个(我承诺{{1 }}):
master
在这里看起来不同寻常的很多东西,我很好奇的是为什么标有“通过GitHub创建gh-pages分支”的提交不断添加。这确实是$ git commit -a -m"hopefully stuff calms down"
Switched to branch 'gh-pages'
First, rewinding head to replay your work on top of it...
gApplying: Create gh-pages branch via GitHub
iApplying: Create gh-pages branch via GitHub
Using index info to reconstruct a base tree...
<stdin>:985: trailing whitespace.
<stdin>:1019: trailing whitespace.
article, aside, canvas, details, embed,
<stdin>:1020: trailing whitespace.
figure, figcaption, footer, header, hgroup,
<stdin>:1031: trailing whitespace.
article, aside, details, figcaption, figure,
<stdin>:1055: trailing whitespace.
line-height: 1.5;
warning: squelched 27 whitespace errors
warning: 32 lines add whitespace errors.
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: Create gh-pages branch via GitHub
Using index info to reconstruct a base tree...
<stdin>:985: trailing whitespace.
<stdin>:1019: trailing whitespace.
article, aside, canvas, details, embed,
<stdin>:1020: trailing whitespace.
figure, figcaption, footer, header, hgroup,
<stdin>:1031: trailing whitespace.
article, aside, details, figcaption, figure,
<stdin>:1055: trailing whitespace.
line-height: 1.5;
warning: squelched 27 whitespace errors
warning: 32 lines add whitespace errors.
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 1 commit.
[master f61b62d] hopefully stuff calms down
1 files changed, 2 insertions(+), 1 deletions(-)
分支上最新的提交,并且可能在执行gh-pages
时被重新附加,但问题似乎是某些东西导致需要合并时应该快进。
我很确定如果我已经正确使用rebase,我可以生成一个日志,其中每个提交到master都在gh-pages中重复(而不是使用merge,其中在gh-pages中创建了合并提交每次在master中提交),但是现在我必须在没有变基的情况下进行合并,否则我会得到这种不圣洁的混乱。