Skip to contentSkip to conversation

Idea for git-touch

DISCUSSION Luís Sousa 3 participants 7 messages Jun 15, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi all,

I have been using GIT for several time and I love it.

I normally do commits when something works or on the end of the day, just to record what have doing. On other day, when I consider that is done/working I do a rebase -i squashing everything on one commit. The date of that commit will be preserved and is the date of the first commit. Then I do a git-reset HEAD~1, git-add . and git-commit with the same message to have the current date.

A nice functionality was a git-touch that did the commands before.

Best regards and keep the good work,
Luís Sousa

P.S.: While writing this message I realize that is easy to accomplish a git-touch doing a bash script, but probably is a good idea to share.

#1 lore raw

Hi Luís,

Quoted 2 lines

[...] Then I do a git-reset HEAD~1, git-add . and git-commit with the same message to have the current date.

There is an existing command that does pretty much exactly that:
git commit --amend.

Jan

#2 lore raw

But still preserves the original date, isn't it?

Quoted 14 lines · Jan Krüger

Hi Luís,

Quoted 3 lines

[...] Then I do a git-reset HEAD~1, git-add . and git-commit with the same message to have the current date.

There is an existing command that does pretty much exactly that:
git commit --amend.

Jan

#3 lore raw
Quoted 1 line · Luís Sousa

But still preserves the original date, isn't it?

Yes, and I just remembered that, too. Sorry. Today is not my day.

Even so, you can still save one command:

  git reset --soft HEAD^
  git commit

Jan

#4 lore raw

Yeah, but still need some copy&paste of message :)

Quoted 16 lines · Jan Krüger
Quoted 2 lines · Luís Sousa

But still preserves the original date, isn't it?

Yes, and I just remembered that, too. Sorry. Today is not my day.

Even so, you can still save one command:

  git reset --soft HEAD^
  git commit

Jan

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 7 lines · Andreas Ericsson
Quoted 6 lines · Luís Sousa

Yeah, but still need some copy&paste of message :)

Quoted 3 lines · Jan Krüger
Quoted 1 line · Luís Sousa

But still preserves the original date, isn't it?

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

Yes, and I just remembered that, too. Sorry. Today is not my day.

Even so, you can still save one command:

git reset --soft HEAD^
git commit

Thanks, but still preserves timestamp.

Quoted 6 lines

Make that

   git reset --soft HEAD^ && git commit -C ORIG_HEAD

and you won't have to bother with copy-pasting.

#7 lore raw
In reply to Luís Sousa
Quoted 6 lines · Luís Sousa

I normally do commits when something works or on the end of the day, just to record what have doing. On other day, when I consider that is done/working I do a rebase -i squashing everything on one commit. The date of that commit will be preserved and is the date of the first commit. Then I do a git-reset HEAD~1, git-add . and git-commit with the same message to have the current date.

git rebase -i <...>
git rebase --ignore-date <...>

should do what you need.