Query on git commit amend

6 messages, 4 authors, 2016-06-15 · open the first message on its own page

Query on git commit amend

From: Viresh Kumar <hidden>
Date: 2016-06-15 22:52:34

Hello,

Suppose i want to add few new changes to my last commit (HEAD).
The way i do it is
$ git add all_changed_files
$ git commit --amend

OR
$ git commit --amend -a

With both these ways, i get a screen to edit the message too.

I want to know if there is a way to skip this screen.

i.e.
$ git commit --amend -a -some_other_option

which simply adds new changes to existing commit, without asking to change
message.

If there is no such way, then can we add a patch for this, if it looks a valid
case.

-- 
viresh

Re: Query on git commit amend

From: Konstantin Khomoutov <hidden>
Date: 2016-06-15 22:52:34

On Tue, 6 Dec 2011 13:53:00 +0530
Viresh Kumar [off-list ref] wrote:
Suppose i want to add few new changes to my last commit (HEAD).
The way i do it is
$ git add all_changed_files
$ git commit --amend

OR
$ git commit --amend -a

With both these ways, i get a screen to edit the message too.

I want to know if there is a way to skip this screen.

i.e.
$ git commit --amend -a -some_other_option

which simply adds new changes to existing commit, without asking to
change message.

If there is no such way, then can we add a patch for this, if it
looks a valid case.
git commit --amend -C HEAD

Re: Query on git commit amend

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:52:34

Am 12/6/2011 9:23, schrieb Viresh Kumar:
Hello,

Suppose i want to add few new changes to my last commit (HEAD).
The way i do it is
$ git add all_changed_files
$ git commit --amend

OR
$ git commit --amend -a

With both these ways, i get a screen to edit the message too.

I want to know if there is a way to skip this screen.

i.e.
$ git commit --amend -a -some_other_option

which simply adds new changes to existing commit, without asking to change
message.
$ git commit --amend -a -C HEAD

But let's count keystrokes (after -a):

<BLANK>-<SHIFT>C<BLANK>HEAD<ENTER>
10 keystrokes (more if you release SHIFT before D)

But if vi pops up you have:

<ENTER><SHIFT>ZZ
4 keystrokes

Where is the advantage of the option?

-- Hannes

Re: Query on git commit amend

From: Viresh Kumar <hidden>
Date: 2016-06-15 22:52:34

On 12/6/2011 2:41 PM, Johannes Sixt wrote:
Am 12/6/2011 9:23, schrieb Viresh Kumar:
$ git commit --amend -a -C HEAD

But let's count keystrokes (after -a):

<BLANK>-<SHIFT>C<BLANK>HEAD<ENTER>
10 keystrokes (more if you release SHIFT before D)

But if vi pops up you have:

<ENTER><SHIFT>ZZ
4 keystrokes

Where is the advantage of the option?
Thanks guys.

@Johannes: You are right but, i will make an alias for the entire command.
So keystrokes are same for me. :)

-- 
viresh

Re: Query on git commit amend

From: Viresh Kumar <hidden>
Date: 2016-06-15 22:52:34

On 12/6/2011 2:50 PM, Viresh Kumar wrote:
On 12/6/2011 2:41 PM, Johannes Sixt wrote:
quoted
Am 12/6/2011 9:23, schrieb Viresh Kumar:
$ git commit --amend -a -C HEAD

But let's count keystrokes (after -a):

<BLANK>-<SHIFT>C<BLANK>HEAD<ENTER>
10 keystrokes (more if you release SHIFT before D)

But if vi pops up you have:

<ENTER><SHIFT>ZZ
4 keystrokes

Where is the advantage of the option?
Thanks guys.

@Johannes: You are right but, i will make an alias for the entire command.
So keystrokes are same for me. :)
There is one more benefit, we don't have to wait for git. We can simply switch to
some other window and work. And can write further command on the same window, in
the time git processes commit --amend.

-- 
viresh

Re: Query on git commit amend

From: Dirk Süsserott <hidden>
Date: 2016-06-15 22:52:34

Am 06.12.2011 10:01 schrieb Konstantin Khomoutov:
On Tue, 6 Dec 2011 13:53:00 +0530
Viresh Kumar [off-list ref] wrote:
quoted
Suppose i want to add few new changes to my last commit (HEAD).
The way i do it is
$ git add all_changed_files
$ git commit --amend

OR
$ git commit --amend -a

With both these ways, i get a screen to edit the message too.

I want to know if there is a way to skip this screen.

i.e.
$ git commit --amend -a -some_other_option

which simply adds new changes to existing commit, without asking to
change message.

If there is no such way, then can we add a patch for this, if it
looks a valid case.
git commit --amend -C HEAD
$ git commit --amend -C HEAD

works fine but will keep the authorship (name _and_ date). To change the
date to the current timestamp, use

$ git commit --amend -C HEAD --reset-author

Note that this will also change the author's name to yours, so it
depends on your case. The commiter's name and timestamp are always
updated to "you/now", independently of that option. To change only the
author's date, use --date=<date>.

Cheers,
    Dirk
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help