threads / discuss / 17442

Force commit date

Subject: Force commit date

## tl;dr

9 messages between Jan 29, 2009 and Jan 29, 2009.

replies: 8people: 4as markdown or json

Zabre· Jan 29, 2009, 18:30 UTC · lore
Hi all,

Some time ago, I used to make 7zip backups of my project directory to keep an history of my changes. (I've kept all of them in separated 7z files) I was then living in darkness. (Even though I tried svn but was somehow not happy with it) Now I've found the light, and git is the best tool around (along with Hg I guess).

I am learning git at the moment and I would like to restore all my 7zipped backups one after the other, use meld to apply each change in the code + directory structure and then git to commit each of them, chronologically, to finally obtain a complete git history of my changes (I even have "commit commentaries" in a special text file, yes I tried to do things properly with basic tools.)

This should be feasible, but what would be very cool in this very special case is if I could force the commit date to reflect the real date each "commit" (read : "zip") was done with my old method in last year, and not the date of my convertion to git.

If it is not, that's not a big deal, but I'd really like to know how to do this, and have my different projects on a git history. (I even have one or two "secondary branches")

There might be an option I am not aware of. (I have seen on this forum / mailing list some people playing with dates but it was the case of mailboxes and "git am") http://n2.nabble.com/how-to-force-a-commit-date-matching-info-from-a-mbox---td2200613.html Remember I'm a beginner trying to learn git, so please bear with me.

Thank you!
-- 
View this message in context: http://n2.nabble.com/Force-commit-date-tp2240539p2240539.html
Sent from the git mailing list archive at Nabble.com.
Sverre Rabbelier· Jan 29, 2009, 18:37 UTC · re: Zabre · lore

Re: Force commit date

On Thu, Jan 29, 2009 at 19:30, Zabre <427@free.fr> wrote:
> There might be an option I am not aware of.
Indeed, try 'import-tars.perl' in the /contrib directory of git.git :).
-- 
Cheers,

Sverre Rabbelier
Zabre· Jan 29, 2009, 18:47 UTC · re: Sverre Rabbelier · lore

Re: Force commit date

Sverre Rabbelier-2 wrote:
> 
> Indeed, try 'import-tars.perl' in the /contrib directory of git.git :).
> 

Thank you Sverre, I'll have a look at this! (sorry for my "wondering" post, I had not seen yours)

-- 
View this message in context: http://n2.nabble.com/Force-commit-date-tp2240539p2240620.html
Sent from the git mailing list archive at Nabble.com.
Zabre· Jan 29, 2009, 18:45 UTC · re: Zabre · lore

Re: Force commit date

I'm wondering : maybe the trick is outside git? Maybe is it possible to specify a "forced date" at which an action (a "git commit" in this case) is done. Some command that would wrap around the git commit command and tell the system "apply this, but do it as if now was 2008-08-23 06:15:34". What do you think? This would be very interesting to know. (btw I'm running Linux obviously)

-- 
View this message in context: http://n2.nabble.com/Force-commit-date-tp2240539p2240602.html
Sent from the git mailing list archive at Nabble.com.
Markus Heidelberg· Jan 29, 2009, 18:55 UTC · re: Zabre · lore

Re: Force commit date

Zabre, 29.01.2009:
Show 6 quoted lines
> 
> I'm wondering : maybe the trick is outside git? Maybe is it possible to
> specify a "forced date" at which an action (a "git commit" in this case) is
> done.
> Some command that would wrap around the git commit command and tell the
> system "apply this, but do it as if now was 2008-08-23 06:15:34".

man git-commit-tree -> GIT_COMMITTER_DATE

Though only in the git-commit-tree docs, it also works with git-commit. Maybe it should be added there, too.

Markus
Zabre· Jan 29, 2009, 19:02 UTC · re: Markus Heidelberg · lore

Re: Force commit date

Markus Heidelberg wrote:
Show 7 quoted lines
> 
> man git-commit-tree
> -> GIT_COMMITTER_DATE
> 
> Though only in the git-commit-tree docs, it also works with git-commit.
> Maybe it should be added there, too.
> 
Thank you Markus, I'll have a look at this too !
-- 
View this message in context: http://n2.nabble.com/Force-commit-date-tp2240539p2240702.html
Sent from the git mailing list archive at Nabble.com.
Daniel Barkalow· Jan 29, 2009, 19:10 UTC · re: Zabre · lore

Re: Force commit date

On Thu, 29 Jan 2009, Zabre wrote:
Show 10 quoted lines
> Markus Heidelberg wrote:
> > 
> > man git-commit-tree
> > -> GIT_COMMITTER_DATE
> > 
> > Though only in the git-commit-tree docs, it also works with git-commit.
> > Maybe it should be added there, too.
> > 
> 
> Thank you Markus, I'll have a look at this too !

You may want to consider whether those dates make most sense as the date of the commit, or the date the changes were done; git tracks both of these separately, in part because it's easy to have some work done at one time, and only make the commit that becomes part of the official project history much later (and these may be done by different people).

The date for the changes being done is set with GIT_AUTHOR_DATE
	-Daniel
*This .sig left intentionally blank*
Zabre· Jan 29, 2009, 19:48 UTC · re: Daniel Barkalow · lore

Re: Force commit date

Daniel Barkalow wrote:
Show 9 quoted lines
> 
> You may want to consider whether those dates make most sense as the date 
> of the commit, or the date the changes were done; git tracks both of 
> these separately, in part because it's easy to have some work done at one 
> time, and only make the commit that becomes part of the official project 
> history much later (and these may be done by different people).
> 
> The date for the changes being done is set with GIT_AUTHOR_DATE
> 

Thank you Daniel, this is very interesting, having a GIT_COMMITTER_DATE and a GIT_AUTHOR_DATE enables me to have both dates, and no need to trick the system then.

-- 
View this message in context: http://n2.nabble.com/Force-commit-date-tp2240539p2240926.html
Sent from the git mailing list archive at Nabble.com.
Zabre· Jan 29, 2009, 20:06 UTC · re: Zabre · lore

Re: Force commit date

For the record, this thread is similar to : http://n2.nabble.com/Committing-with-past-date--td795326.html

-- 
View this message in context: http://n2.nabble.com/Force-commit-date-tp2240539p2241010.html
Sent from the git mailing list archive at Nabble.com.

← back to recent threads