git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: norm@dad.org
Cc: git@vger.kernel.org
Subject: Re: Getting the "message" given a branch designation and conversely
Date: Mon, 15 Aug 2016 08:28:20 -0400	[thread overview]
Message-ID: <20160815122820.msajaamgmlexe2jd@sigill.intra.peff.net> (raw)
In-Reply-To: <201608141458.u7EEwF8P099500@shell1.rawbw.com>

On Sun, Aug 14, 2016 at 07:58:14AM -0700, norm@dad.org wrote:

> I am learning how to use git. I would like to know how:
> 
> Given a branch's designation, such as "master~4", how can I see the message I
> furnished when I created the branch using "git commit"?

Somebody already pointed you at "git log", which is the right tool for
looking at commit messages (or perhaps "git show" if you only want to
see a single entry).

> Conversely, given the message I furnished to "git commit", when I created a
> branch, how can I see the branch's designation?

Try "git log --grep=some.regex" to find a particular commit. Usually we
refer to commits by their sha1 id, which will be shown by git-log.
However, you can use git-describe to generate a name for any commit that
is based on traversing from a tag. Try:

  git describe --contains --all <sha1>

for example. Using "--all" tells git to consider names based on branches
as well as tags. Using "--contains" will generate a name based on
traversing backwards from the tags and branches (like "master~4") rather
than basing the name on a tag that you build off of.

-Peff

  parent reply	other threads:[~2016-08-15 12:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-14 14:58 Getting the "message" given a branch designation and conversely norm
2016-08-14 17:32 ` Philip Oakley
2016-08-15 12:28 ` Jeff King [this message]
2016-08-24 14:39   ` Jakub Narębski

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=20160815122820.msajaamgmlexe2jd@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=norm@dad.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).