From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sergey Organov Newsgroups: gmane.emacs.help Subject: Re: Git/Magit: To which branch was a commit was originally committed? Date: Mon, 01 Nov 2021 20:18:22 +0300 Message-ID: References: <87zgqo2b5q.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17806"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 01 18:20:55 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mhazN-0004Pm-VK for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 01 Nov 2021 18:20:53 +0100 Original-Received: from localhost ([::1]:48674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhazN-0004im-1k for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 01 Nov 2021 13:20:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhax5-00012L-Ih for help-gnu-emacs@gnu.org; Mon, 01 Nov 2021 13:18:31 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:58918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhax4-0007N7-8w for help-gnu-emacs@gnu.org; Mon, 01 Nov 2021 13:18:31 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mhax1-0000wj-Ec for help-gnu-emacs@gnu.org; Mon, 01 Nov 2021 18:18:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 24 X-Spam_score: 2.4 X-Spam_bar: ++ X-Spam_report: (2.4 / 5.0 requ) DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:134297 Archived-At: Daniel Fleischer 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