* Git/Magit: To which branch was a commit was originally committed?
@ 2021-11-01 14:38 Michael Heerdegen
2021-11-01 16:01 ` Daniel Fleischer
2021-11-01 16:09 ` Daniel Fleischer
0 siblings, 2 replies; 6+ messages in thread
From: Michael Heerdegen @ 2021-11-01 14:38 UTC (permalink / raw)
To: Emacs mailing list
Hello,
sorry if I'm missing something obvious.
I'm using Magit. I follow the development of the Emacs repository. I
have checked out master. Because the release branch is regularly merged
into master, Git and Magit only tell me that all commits in the
graphical log are now contained in master. When I click on a commit, in
the overview buffer of the commit, there is, AFAIU, no visible
indication to which branch this commit originally had been committed.
The graphical log also doesn't provide that information. With other
words: I have no idea which branch is which.
What is the smartest way to find out? (Hopefully without moving head
and such things...)
TIA,
Michael.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Git/Magit: To which branch was a commit was originally committed?
2021-11-01 14:38 Git/Magit: To which branch was a commit was originally committed? Michael Heerdegen
@ 2021-11-01 16:01 ` Daniel Fleischer
2021-11-01 16:09 ` Daniel Fleischer
1 sibling, 0 replies; 6+ messages in thread
From: Daniel Fleischer @ 2021-11-01 16:01 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Emacs mailing list
Michael Heerdegen [2021-11-01 Mon 15:38] wrote:
> What is the smartest way to find out? (Hopefully without moving head
> and such things...)
Hi, first view the commit you're in; either pressing "space" when in the
magit-status buffer or if you are in the graphical log buffer, make sure
the pointer is on your current commit and press "space" or "return". You
can also open a log buffer centered on your current commit via "l l".
Then in the commit buffer, there should be a field called "contained:
...". It should tell you which branch you are following.
--
Daniel Fleischer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Git/Magit: To which branch was a commit was originally committed?
2021-11-01 14:38 Git/Magit: To which branch was a commit was originally committed? Michael Heerdegen
2021-11-01 16:01 ` Daniel Fleischer
@ 2021-11-01 16:09 ` Daniel Fleischer
2021-11-01 17:18 ` Sergey Organov
1 sibling, 1 reply; 6+ messages in thread
From: Daniel Fleischer @ 2021-11-01 16:09 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Emacs mailing list
Upon thinking, one cannot answer the question you're asking. This is
because commits do not hold this information; they don't "remember" in
which branch they were. Git history is a graph where commits are nodes.
Branches are labels we stick to specific nodes. When we update, we move
a label forward to another node. That previous node does not "remember"
that a label was used to be attached to it. The answer I gave you a
minute ago only answers the following question: if I start from a given
commit/node and go forward in time, which branches/labels would I meet?
it answers your question only in the simplest cases (no splits) but
hopefully that is what you're looking for.
Best,
--
Daniel Fleischer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Git/Magit: To which branch was a commit was originally committed?
2021-11-01 16:09 ` Daniel Fleischer
@ 2021-11-01 17:18 ` Sergey Organov
2021-11-01 19:34 ` Michael Heerdegen
0 siblings, 1 reply; 6+ messages in thread
From: Sergey Organov @ 2021-11-01 17:18 UTC (permalink / raw)
To: help-gnu-emacs
Daniel Fleischer <danflscr@gmail.com> writes:
> Upon thinking, one cannot answer the question you're asking. This is
> because commits do not hold this information; they don't "remember" in
> which branch they were. Git history is a graph where commits are nodes.
> Branches are labels we stick to specific nodes. When we update, we move
> a label forward to another node. That previous node does not "remember"
> that a label was used to be attached to it. The answer I gave you a
> minute ago only answers the following question: if I start from a given
> commit/node and go forward in time, which branches/labels would I meet?
> it answers your question only in the simplest cases (no splits) but
> hopefully that is what you're looking for.
I think that closest thing to the original request would be a way to
list branches from which the commit in question is reachable if we
follow first parent only. This way branches to which the commit "was
merged" won't appear in the list. I dunno how to achieve it either in
Git or Magit without additional scripting though.
-- Sergey Organov
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Git/Magit: To which branch was a commit was originally committed?
2021-11-01 17:18 ` Sergey Organov
@ 2021-11-01 19:34 ` Michael Heerdegen
2021-11-02 14:12 ` Sergey Organov
0 siblings, 1 reply; 6+ messages in thread
From: Michael Heerdegen @ 2021-11-01 19:34 UTC (permalink / raw)
To: help-gnu-emacs
Sergey Organov <sorganov@gmail.com> writes:
> I think that closest thing to the original request would be a way to
> list branches from which the commit in question is reachable if we
> follow first parent only. This way branches to which the commit "was
> merged" won't appear in the list. I dunno how to achieve it either in
> Git or Magit without additional scripting though.
After some quick experimentation I think it could be that moving point
with `magit-log-move-to-parent' doesn't leave the current branch. Seems
also that the (checked out) master branch is also always the leftmost
line in the graphical view. Can anyone confirm?
Michael.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Git/Magit: To which branch was a commit was originally committed?
2021-11-01 19:34 ` Michael Heerdegen
@ 2021-11-02 14:12 ` Sergey Organov
0 siblings, 0 replies; 6+ messages in thread
From: Sergey Organov @ 2021-11-02 14:12 UTC (permalink / raw)
To: help-gnu-emacs
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Sergey Organov <sorganov@gmail.com> writes:
>
>> I think that closest thing to the original request would be a way to
>> list branches from which the commit in question is reachable if we
>> follow first parent only. This way branches to which the commit "was
>> merged" won't appear in the list. I dunno how to achieve it either in
>> Git or Magit without additional scripting though.
>
> After some quick experimentation I think it could be that moving point
> with `magit-log-move-to-parent' doesn't leave the current branch. Seems
> also that the (checked out) master branch is also always the leftmost
> line in the graphical view. Can anyone confirm?
Even though rather close, the leftmost column is not, strictly speaking,
the checked-out branch, it's rather the chain of commits that is the
result of following the first parent when traversing the history DAG
back starting from the current branch.
Essentially, this does give you the history of the master branch, taking
into account the workflow being used to manage Emacs Git repository.
As `magit-log-move-to-parent' without arguments seem to follow the first
parent, it will indeed either move over that leftmost column, or
eventually gravitate to it if you start at some side branch.
-- Sergey Organov
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-11-02 14:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-01 14:38 Git/Magit: To which branch was a commit was originally committed? Michael Heerdegen
2021-11-01 16:01 ` Daniel Fleischer
2021-11-01 16:09 ` Daniel Fleischer
2021-11-01 17:18 ` Sergey Organov
2021-11-01 19:34 ` Michael Heerdegen
2021-11-02 14:12 ` Sergey Organov
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).