git p4 rebase尝试重新应用过去的提交

git p4 rebase尝试重新应用过去的提交,git,perforce,git-p4,Git,Perforce,Git P4,我在git p4 rebase上遇到了一个问题,我不知道如何开始诊断这个问题,更不用说问题是什么了 因此,我用git-p4从perforce工作区克隆了一个git repo,它被用作远程repo,作为一个桥梁,这样团队可以对一个远程repo使用git,然后定期将repo的更改推回到工作区 通常情况下,工作流程要么是该人员在主分支上进行编辑,git-a commits他们,git再次拉s,然后git推s他们到远程repo,要么他们创建一个分支,然后在完成后将该分支合并回来,然后将主分支推到远程。如

我在git p4 rebase上遇到了一个问题,我不知道如何开始诊断这个问题,更不用说问题是什么了

因此,我用git-p4从perforce工作区克隆了一个git repo,它被用作远程repo,作为一个桥梁,这样团队可以对一个远程repo使用git,然后定期将repo的更改推回到工作区

通常情况下,工作流程要么是该人员在主分支上进行编辑,
git-a commit
s他们,
git再次拉
s,然后
git推
s他们到远程repo,要么他们创建一个分支,然后在完成后将该分支合并回来,然后将主分支推到远程。如果花一天以上的时间,他们可能偶尔会把树枝往上推

当我把东西推回到perforce时,我在远程repo中运行以下命令

git checkout -f
git clean -f
git p4 rebase --import-labels
git p4 submit -M --export-labels
git checkout -f
git clean -f
远程回购协议不是空的,这就是为什么我在前后运行checkout和clean

基本上每隔一段时间,在更改被推回之后,当我执行git p4重新基址时,就会出现以下错误

Performing incremental import into refs/remotes/p4/master git branch
Depot paths: //depot/sub/folder/
No changes to import!
Rebasing the current branch onto remotes/p4/master
First, rewinding head to replay your work on top of it...
Applying: A commit that has already been made previously
Applying: A second commit that has already been made in a previous commit
Using index info to reconstruct a base tree...
<stdin>:15: space before tab in indent.
                            a line of text
<stdin>:24: space before tab in indent.
                another line of text
<stdin>:25: space before tab in indent.
                a third line of text
<stdin>:33: trailing whitespace.
        a forth line of text
<stdin>:71: trailing whitespace.

warning: squelched 1 whitespace error
warning: 6 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging file from second
CONFLICT (content): Merge conflict in a/file/in/the/second/pre-existing/commit/file.php
Auto-merging a/file/in/the/second/pre-existing/commit/file.php
Failed to merge in the changes.
Patch failed at 0002 A second commit that has already been made in a previous commit

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".

Traceback (most recent call last):
  File "/usr/lib/git-core/git-p4", line 3373, in <module>
    main()
  File "/usr/lib/git-core/git-p4", line 3367, in main
    if not cmd.run(args):
  File "/usr/lib/git-core/git-p4", line 3150, in run
    return self.rebase()
  File "/usr/lib/git-core/git-p4", line 3167, in rebase
    system("git rebase %s" % upstream)
  File "/usr/lib/git-core/git-p4", line 183, in system
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'git rebase remotes/p4/master' returned non-zero exit status 1
执行到refs/remotes/p4/master git分支的增量导入
仓库路径://Depot/sub/folder/
无需更改即可导入!
将当前分支重新设置为remotes/p4/master
首先,倒带头部,在其上重放您的工作。。。
应用:以前已进行的提交
应用:在上一次提交中已经进行的第二次提交
正在使用索引信息重建基树。。。
:15:缩进中制表符前的空格。
一行文字
:24:缩进中制表符前的空格。
另一行文字
:25:缩进中制表符前的空格。
第三行文字
:33:尾随空格。
第四行文字
:71:尾随空格。
警告:静噪1空格错误
警告:6行添加空白错误。
退回到修补基础和3路合并。。。
自动合并第二个文件
冲突(内容):在/file/in/the/second/pre-existing/commit/file.php中合并冲突
自动合并/file/in/the/second/pre-existing/commit/file.php
未能在更改中合并。
修补程序在0002第二次提交时失败,该提交已在上一次提交中进行
解决此问题后,运行“git-rebase--continue”。
如果您希望跳过此修补程序,请运行“git-rebase--skip”。
要签出原始分支并停止重定基址,请运行“git-rebase--abort”。
回溯(最近一次呼叫最后一次):
文件“/usr/lib/git-core/git-p4”,第3373行,在
main()
文件“/usr/lib/git-core/git-p4”,第3367行,主文件
如果不是cmd.run(args):
文件“/usr/lib/git-core/git-p4”,第3150行,运行中
返回self.rebase()
文件“/usr/lib/git-core/git-p4”,第3167行,在rebase中
系统(“git重新基准%s”%s上游)
文件“/usr/lib/git-core/git-p4”,第183行,在系统中
引发被调用的进程错误(retcode,cmd)
subprocess.CalledProcessError:命令'git rebase remotes/p4/master'返回非零退出状态1
所以我有很多问题,在这里,当它在做git rebase时,作为
git p4 rebase
的一部分,它在重新应用一些已经应用于远程REST的提交,这些提交已经从以前的
git p4 rebase
推回到工作区。重复提交从何而来?为什么它还在试图通过回购协议重播这些信息

当我在repo的工作副本中检查文件时,它与工作区是一样的,因为自从上一次
gitp4 rebase
以来,我没有做任何更改。因此,
git-rebase--continue
实际上什么都不做

唯一的解决方案是运行
git-rebase--skip
,但当我这样做时,在以后运行
git-p4-rebase
时会出现相同的消息,每次我都必须重新运行
git-rebase--skip
。这太令人恼火了

偶尔,我也不完全确定,在读完这条消息后,当我运行
gitp4submit
时,它会如何将提交推送到p4工作区,从而导致重复的p4提交和混乱的文件。我相信当我运行
git-rebase--continue
,然后
git-rebase--skip
然后
git-p4-submit

当我检查git日志时,HEAD通常比master先提交,但是如何提交呢

然后偶尔错误会再次消失,我无法准确地计算出它消失的条件


我怎么才能开始解决这个问题呢?

我想我还是对你的工作流程感到困惑。您是直接将提交推送到Perforce,还是推送到运行
gitp4 submit
的原始git repo。如果你做的是后者,那么我认为这是你的主要问题。您需要将本地更改直接推送到Perorce,然后使用
git p4 rebase
将所有内容同步回来。当您执行一个git p4 submit时,新的提交会在被推送到perforce之前被修改,这就是为什么您不能先推送到另一个git repo

如果您总是从创建comit的客户端计算机提交
p4
,则您的错误可能是由于Performce端的某些类型的用户名/电子邮件不匹配造成的。每个git提交sha1都使用作者电子邮件和提交日期(以及其他内容)作为基础,如果这些值发生变化,则很可能
git-p4 rebase
将生成与本地不同的sha1,并向您发送错误消息

git-p4
试图通过创建perforce用户名到电子邮件映射文件来弥补这一缺陷。我忘记了这个文件保存在哪里,但是如果您丢失了它,那么git-p4将变得混乱,并尝试重新应用您已经拥有的提交

因此,解决方案要么是不更改perforce端的电子邮件值,要么是任何可能会混淆
git-p4
的内容。如果您在perforce中更改电子邮件,则必须确保