Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git commit broken time zone

Tags:

git

rebase

fsck

> 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?

like image 930
Alex Avatar asked May 22 '15 09:05

Alex


People also ask

Can we change commit time in git?

For all commits where you want to change the date, replace pick by edit (or just e ), then save and quit your editor. The first date is the commit date, the second one is the author date. Repeat the process until you amend all your commits. Check your progression with git status .

Does git store time zones?

Each committer's timezone is surely saved in github's server.

How do I edit a previous commit?

The git commit --amend command is a convenient way to modify the most recent commit. It lets you combine staged changes with the previous commit instead of creating an entirely new commit. It can also be used to simply edit the previous commit message without changing its snapshot.

How do you check if a commit is tagged?

Check the documentation for git describe . It finds the nearest tag to a given commit (that is a tag which points to an ancestor of the commit) and describes that commit in terms of the tag. In newer versions, git describe --tags --abbrev=0 REV will be useful when you don't want the junk on the tag.


1 Answers

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.

like image 86
IwishIcanFLighT Avatar answered Oct 22 '22 20:10

IwishIcanFLighT