threads / discuss / 21592

Idea for git-touch

Subject: Idea for git-touch

## tl;dr

7 messages between Nov 12, 2009 and Nov 16, 2009.

replies: 6people: 3as markdown or json

Luís Sousa· Nov 12, 2009, 16:15 UTC · lore
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.

Jan Krüger· Nov 12, 2009, 17:01 UTC · re: Luís Sousa · lore

Re: Idea for git-touch

Hi Luís,
> [...] 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
Luís Sousa· Nov 12, 2009, 17:05 UTC · re: Jan Krüger · lore

Re: Idea for git-touch

But still preserves the original date, isn't it?
Jan Krüger wrote:
Show 14 quoted lines
> Hi Luís,
>
>   
>> [...] 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
>
>
>   
Jan Krüger· Nov 12, 2009, 17:08 UTC · re: Luís Sousa · lore

Re: Idea for git-touch

On Thu, 12 Nov 2009 17:05:21 +0000, Luís Sousa <llsousa@ualg.pt> wrote:
> 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
Luís Sousa· Nov 12, 2009, 17:13 UTC · re: Jan Krüger · lore

Re: Idea for git-touch

Yeah, but still need some copy&paste of message :)
Jan Krüger wrote:
Show 16 quoted lines
> On Thu, 12 Nov 2009 17:05:21 +0000, Luís Sousa <llsousa@ualg.pt> wrote:
>   
>> 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
>
>
>   
Michele Ballabio· Nov 12, 2009, 17:18 UTC · re: Luís Sousa · lore

Re: Idea for git-touch

On Thursday 12 November 2009, Luís Sousa wrote:
Show 6 quoted lines
> 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.
Luís Sousa· Nov 16, 2009, 10:57 UTC · lore

Re: Idea for git-touch

Andreas Ericsson wrote:
Show 15 quoted lines
> On 11/12/2009 06:13 PM, Luís Sousa wrote:
>> Yeah, but still need some copy&paste of message :)
>>
>> Jan Krüger wrote:
>>> On Thu, 12 Nov 2009 17:05:21 +0000, Luís Sousa <llsousa@ualg.pt> wrote:
>>>> 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
>>>
>
Thanks, but still preserves timestamp.
Show 6 quoted lines
> Make that
>
>    git reset --soft HEAD^ && git commit -C ORIG_HEAD
>
> and you won't have to bother with copy-pasting.
>

← back to recent threads