Re: Query on git commit amend
- From
- Dirk Süsserott <newsletter@dirk.my1.cc>
- Date
- Dec 6, 2011, 19:09 UTC
- Message-ID
- <4EDE687E.7020604@dirk.my1.cc>
- In-Reply-To
- <20111206130138.119db519.kostix@domain007.com>
Am 06.12.2011 10:01 schrieb Konstantin Khomoutov:
Show 24 quoted lines
> On Tue, 6 Dec 2011 13:53:00 +0530 > Viresh Kumar <viresh.kumar@st.com> 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
$ 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