3

I've got a git repository where I'm the only committer, so far, and that has already been published on github. I found that a few commits, being done from a different computer, has the wrong author information. My idea was to remove the repository from github, rewrite history and republish it as new. For such purpose I've created a simple script:

git filter-branch --commit-filter '
            GIT_COMMITTER_NAME="Author Name";
            GIT_AUTHOR_NAME="Author Name";
            GIT_COMMITTER_EMAIL="email";
            GIT_AUTHOR_EMAIL="email";
            git commit-tree "$@";

    ' HEAD

which should rename all commits. The problem is that git replies with

Cannot rewrite branch(es) with a dirty working directory.

but a git status provides me

# On branch master
nothing to commit (working directory clean)

Any idea about what am I missing? Any suggestion on how to rename all commits without loosing the history will be appreciated.

fluca1978
  • 3,968
  • 2
  • 15
  • 15

1 Answers1

0

Try deleting untracked files in your working directory by running git clean -dxf.

Also, you'll need to export those variables in your commit-filter. If you don't, Git won't see them so they won't alter Git's default behavior.

Richard Hansen
  • 51,690
  • 20
  • 90
  • 97