我遇到了 git p4 rebase 问题,我不知道如何开始诊断问题,更不用说问题是什么了。
所以我有一个 git-p4 从 perforce 工作区克隆的 git repo,它被用作远程 repo 以充当桥梁,因此团队可以针对一个远程 repo 使用 git,然后定期,我可以将 repo 的更改推送回工作区。
通常工作流程是这个人在主分支上,进行编辑,git -a commit
s,git pull
再次,然后将git push
它们发送到远程仓库,或者他们创建一个分支,然后在他们完成后将该分支合并回来然后将主分支推送到远程。如果他们需要超过一天的时间,他们可能会偶尔将分支向上推。
当我将东西推回 perforce 时,我在远程仓库中运行以下命令
git checkout -f
git clean -f
git p4 rebase --import-labels
git p4 submit -M --export-labels
git checkout -f
git clean -f
远程仓库不是裸露的,这就是我在前后运行结帐和清理的原因
基本上不时地,在更改被推回后,当我执行 git p4 rebase 时,我收到以下错误
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
所以我有很多问题,在这里,当它执行 git rebase 时git p4 rebase
,它会重新应用一些已经应用到远程仓库的提交,这些提交已经从以前的git p4 rebase
. 重复提交从何而来?为什么它仍然试图通过 repo 重放它们?
当我在 repo 的工作副本中检查文件时,它与工作区相同,因为自上次git p4 rebase
. 结果git rebase --continue
并没有真正做任何事情。
唯一的解决方案是运行git rebase --skip
,但是当我这样做时,当我随后运行时会出现相同的消息,并且每次git p4 rebase
都必须重新运行。git rebase --skip
真让人生气。
有时,我不完全确定在通过此消息后,它实际上会如何在我运行时将提交推送到 p4 工作区,git p4 submit
从而导致重复的 p4 提交和混乱的文件。我相信它会在我跑步时发生git rebase --continue
,git rebase --skip
然后git p4 submit
当我检查 git 日志时,HEAD 通常在 master 之前提交,但是如何?
然后偶尔错误会再次消失,我无法弄清楚它消失的确切条件。
我什至如何开始解决这个问题?