ysap
ysap

Reputation: 8115

How to finish this git rebase operation?

I cloned a remote repo, then branched a feature branch mybranch out of master. A few commits later, running git status I see:

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)

which is fine, as I don't care about ABC and XYZ binary directories.

Now, I want to rebase my branch on master to incorporate latest updates that were pushed by teammates. So, I checkout master, pull the latest changes, checkout mybranch again and do:

git rebase master

The rebase runs until a point where I get the following message:

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)

Checking the status at this point yields:

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/

Our project (and repo) is maintained in a mixed Linux-Windows environment. Apparently, the files indicated above are man files of the Perl package, that are not cloned correctly on the Windows environment (due to ugly filenames?)

How can I conclude this rebase operation and overcome this stage of the process?

UPDATE 1: If it matters, the local repo was cloned using a sparse checkout. The problematic files are part of a directory not on the local workspace.

UPDATE 2: Following @TriskalJM's answer, I committed the changes at that stage:

git commit -m "MY-COMMENT" .

and got this message:

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

Checking status shows that the rebase operation is not done yet, so using --continue, I get the following message:

sed: can't read blah/.git/rebase-apply/info: No such file or directory

Is there any way to force the finish of this rebase?

Upvotes: 3

Views: 2400

Answers (1)

TriskalJM
TriskalJM

Reputation: 2459

Unfortunately, you've hit upon one of the problems with using git cross-platform. The developers who added those files to the repo have committed a grievous sin because they've made it impossible to use the workflow as intended from a Windows machine.

You're going to have to commit the changes as-is (which will remove those man pages), and have them recommit those pages from a linux machine.

In addition, it sounds like you need to have a discussion as a team about how to mitigate this in the future.

Also, if you don't care about model/ABC and model/XYZ because they contain binaries, you should add those to a .gitignore.

Upvotes: 2

Related Questions