git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: Re: changing log entries
Date: Fri, 15 Dec 2006 09:48:44 +0100	[thread overview]
Message-ID: <eltncn$te5$1@sea.gmane.org> (raw)
In-Reply-To: 200612141037.35061.andyparkins@gmail.com

Andy Parkins wrote:

> On Wednesday 2006 December 13 23:08, Jon Masters wrote:
> 
>> Anyway, now I would like to change an existing log entry to make it a
>> bit cleaner (read: add a first line that's under 80 characters). What's
>> the best way to change an existing log entry for a commit?
> 
> If it's HEAD you want to change:
>  git-commit --amend
> 
> If it's not, it's a bit harder.  You could pull each commit out as a patch and 
> apply them again later after a git-reset.  However, git has a tool for 
> automating a lot of that:  git-rebase.  man git-rebase has some excellent 
> examples.
> 
>  * -- A -- B -- C (master)
> 
> Let's say you want to edit A; make a new branch at A:
> 
> $ git branch temp-edit-branch master^^
>  
>  * -- A (temp-edit-branch)
>        \
>         B -- C (master)
> 
> Edit A with git-commit --amend.  This makes a new A, A' that has the new 
> commit message:
> 
>  * -- A' (temp-edit-branch)
>   \
>    A -- B -- C (master)
> 
> Then you switch to "master" and rebase master onto temp-edit-branch; you can 
> then delete temp-edit-branch
> 
> $ git-checkout master
> $ git-rebase temp-edit-branch

Theoretically you should do

$ git rebase --onto temp-edit-branch master^^ master

but thanks to automatic detection that patch is already applied the
above also should work. Well, unless you edit the commit so much
that git does not recognize it as the same commit...

> $ git branch -D temp-edit-branch
> 
>  * -- A' -- B' -- C' (master)
>   \
>    A -- B -- C

...in which case "git rebase temp-edit-branch master" would give you

  * -- A' --A* -- B* -- C* (master)
   \
    A -- B -- C

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


      reply	other threads:[~2006-12-15  8:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-13 23:08 changing log entries Jon Masters
2006-12-13 23:22 ` Jakub Narebski
2006-12-13 23:24 ` Shawn Pearce
2006-12-14 10:37 ` Andy Parkins
2006-12-15  8:48   ` Jakub Narebski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='eltncn$te5$1@sea.gmane.org' \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).