9
> git fsck
error in commit %hash%: invalid author/committer line - bad time zone

> git show %hash%
Date: Mon Mar 18 23:57:14 2201 -5274361

How this can be fixed? With git rebase in master branch and delete\update commit info, or do some magic in project .git directory, or somehow else?

Alex
  • 571
  • 1
  • 8
  • 26
  • Well rebasing and removing/updating the commit would result in a massive history rewrite which might not be preferrable. The most interesting part for me is how this error could happend? I don't have a answer yet. – ckruczek May 22 '15 at 10:15
  • What version of Git are you using? Do you use it in conjunction with any third-party tool? – jub0bs May 22 '15 at 10:16
  • Remote repo git version is 1.7, my (client) is 1.9, nothing else is used. – Alex May 22 '15 at 13:07
  • The important is what version of Git was used to create the guilty commit. – Matthieu Moy May 28 '15 at 06:43
  • Can you run `git cat-file -p %hash%`? – Matthieu Moy May 28 '15 at 06:43
  • `> git cat-file -p %brokenCommitHash% 100644 blob hash1 filename1 100644 blob hash2 filename2 040000 tree hash3 dirname` Sorry, cant get correct code formatting ( – Alex May 28 '15 at 19:14
  • fastexport + fastimport the repo.. This is a crazy error.. But its clear your repo is brooken! :( – Pogrindis Jul 21 '15 at 09:34

2 Answers2

3

I'd go for the git rebase -i solution.

Edit the wrong commits and git commit --amend --date="Mon Jul 24 14:00 2015 +0100" when you stop on them.

If you rebase on pushed commits, you'll have to rewrite the branch history (in your case master) by doing a push -f.

a1pancakes
  • 503
  • 4
  • 7
0

EDIT: If the rebase option does not work.. I would write off trying to repair the repo..

I would go with a fast export and fast import..

git fast-export --all | (cd /cleanrepo/ && git fast-import)

I would add the --anonymize to remove all identifying info if the above fails..

Pogrindis
  • 7,755
  • 5
  • 31
  • 44