1

I just import my porject from svn to git

So i plan to do some cleanup to my commit history

Let say i have this kind of commit history (all already been push)

Commit   Message                                 Date  
..
ffa7e08  change error message on isfileuploade.. 2012-06-04

85a467f  change error message on extension..    2012-05-24

49f3a89  add exit(), on execute() method ..     2012-05-09

af68b2b  add method getFileName                2012-05-04
..

How can i change the commit message for 49f3a89 without changing it date?

If i do git rebase -i af68b2b, i successfully change the commit message and apparently it old commit date too..

Is there a way to remedy this?

slier
  • 6,511
  • 6
  • 36
  • 55
  • 1
    `git rebase` does not change the author date - only the commit date. So you must be seeing something else... – sleske Oct 21 '13 at 10:33
  • @sleske i thought only rebase without interactive dosent change the author date..i guess im wrong..i edited my question..is there a way to preserve old commit date? – slier Oct 21 '13 at 10:40
  • @sleske i take the `date` from bitbucket commits tab..not sure if it author date or commit date – slier Oct 21 '13 at 10:42

2 Answers2

6

Taking from this stackoverflow answer:

git filter-branch --env-filter 'GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE; export GIT_COMMITTER_DATE'

…did solve my problem.

Community
  • 1
  • 1
slier
  • 6,511
  • 6
  • 36
  • 55
0

How about that:

  1. gitk --all // for better viewing
  2. right click on commit 49f3a89 and reset dev branch to here
  3. git gui and commit -> ammend last commit
  4. now you are able to ammend commit 49f3a89 with whatever data you want
  5. commit and you can cherry pick changes from later commit af68b2b

Not sure if that's help?

xproph
  • 1,171
  • 11
  • 7