我克隆了一个远程仓库,然后从mybranch
分支了一个功能分支master
。稍后提交一些提交,运行git status
我看到了:
On branch mybranch
Untracked files:
(use "git add <file>..." to include in what will be committed)
model/ABC/
model/XYZ/
nothing added to commit but untracked files present (use "git add" to track)
这很好,因为我不关心ABC
和XYZ
二进制目录。
现在,我想在master上重新设置我的分支,以包含由队友推送的最新更新。因此,我结帐master
,提取最新更改,再次结帐mybranch
并执行:
git rebase master
rebase一直运行到我收到以下消息:
First, rewinding head to replay your work on top of it...
Dirty index: cannot apply patches (dirty: blahblah/local_install/Perl/man/man3/Convert::Binary::C.3
blahblah/local_install/Perl/man/man3/Convert::Binary::C::Cached.3
blahblah/local_install/Perl/man/man3/Digest::CRC.3)
此时检查状态会产生:
You are currently editing a commit while rebasing branch 'mybranch' on '4e4ad5a'.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: blahblah/local_install/Perl/man/man3/Convert::Binary::C.3
deleted: blahblah/local_install/Perl/man/man3/Convert::Binary::C::Cached.3
deleted: blahblah/local_install/Perl/man/man3/Digest::CRC.3
Untracked files:
(use "git add <file>..." to include in what will be committed)
model/ABC/
model/XYZ/
我们的项目(和repo)在混合的Linux-Windows环境中维护。显然,上面显示的文件是Perl包的man文件,在Windows环境中没有正确克隆(由于文件名很丑?)
如何完成此rebase操作并克服此过程的这一阶段?
更新1:如果重要,则使用稀疏结账克隆本地仓库。有问题的文件是本地工作区上不目录的一部分。
更新2:在@TriskalJM回答之后,我在那个阶段做出了改变:
git commit -m "MY-COMMENT" .
并收到此消息:
error: Invalid path 'blahblah/local_install/Perl/man/man3/Convert::Binary::C.3'
error: Invalid path 'blahblah/local_install/Perl/man/man3/Convert::Binary::C::Cached.3'
error: Invalid path 'blahblah/local_install/Perl/man/man3/Digest::CRC.3'
[detached HEAD 12d77df] MY-COMMENT
3 files changed, 12542 deletions(-)
delete mode 100644 blahblah/local_install/Perl/man/man3/Convert::Binary::C.3
delete mode 100644 blahblah/local_install/Perl/man/man3/Convert::Binary::C::Cached.3
delete mode 100644 blahblah/local_install/Perl/man/man3/Digest::CRC.3
检查状态显示rebase
操作尚未完成,因此使用--continue
,我收到以下消息:
sed: can't read blah/.git/rebase-apply/info: No such file or directory
有没有办法强制完成这个rebase?
答案 0 :(得分:1)
不幸的是,您已经遇到了使用git跨平台的一个问题。将这些文件添加到回购中的开发人员犯下了严重的罪行,因为他们无法按照Windows机器的意图使用工作流程。
您必须按原样提交更改(这将删除这些手册页),并让他们从Linux机器重新发送这些页面。
此外,听起来您需要作为一个团队进行讨论,讨论如何在未来缓解这种情况。
此外,如果您不关心model/ABC
和model/XYZ
因为它们包含二进制文件,则应将其添加到.gitignore
。