1

所以我一直在尝试使用以下post-commit钩子让我的gh-pages分支与 master 保持同步:

#!/bin/sh
git checkout gh-pages
git rebase master
git checkout master

根据这里的建议

这是我的 gitlg命令的一些输出(我在 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]

历史的其余部分非常无趣(这里是一个 github 网络图表示,可能不那么令人头疼),我希望保持新的位(更新gh-pages)也无趣,但我很清楚是对的现在有大量非快进合并正在发生,如果rebase正确发生则不应该发生。

因此,由于我完全不知道从哪里开始诊断变基发生时出现问题的问题,我将向您展示我上次提交的输出,它产生了这个(我承诺master):

$ 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(-)

在众多看起来与众不同的事情中,我很好奇的是为什么标有“通过 GitHub 创建 gh-pages 分支”的提交不断被添加。这确实是分支上最新的提交,gh-pages并且可能会在执行rebase.

我很确定,如果我正确地使用 rebase,我可以生成一个日志,其中对 master 的每个提交都在 gh-pages 中重复(而不是使用 merge,在 gh-pages 中为每个提交创建合并提交)大师),但现在我必须在没有变基的情况下进行合并,否则我会得到这个邪恶的混乱。

4

0 回答 0