Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The creator for Hudson (now Jenkins) <a href="https://github.com/kohsuke" rel="noreferrer">Kohsuke Kawaguchi</a> just published (November 2013):<br> <a href="https://gist.github.com/kohsuke/7590246" rel="noreferrer">kohsuke / git-children-of</a>:</p> <blockquote> <p>Given a commit, find immediate children of that commit.</p> </blockquote> <pre class="lang-sh prettyprint-override"><code>#!/bin/bash -e # given a commit, find immediate children of that commit. for arg in "$@"; do for commit in $(git rev-parse $arg^0); do for child in $(git log --format='%H %P' --all | grep -F " $commit" | cut -f1 -d' '); do git describe $child done done done </code></pre> <hr> <p>As illustrated by <a href="http://www.nntp.perl.org/group/perl.perl5.porters/2009/01/msg143820.html" rel="noreferrer">this thread</a>, in a VCS based on history represented by a <a href="http://en.wikipedia.org/wiki/Directed_acyclic_graph" rel="noreferrer">DAG (Directed Acyclic Graph)</a>, there is not "one parent" or "one child".</p> <pre><code> C1 -&gt; C2 -&gt; C3 / \ A -&gt; B E -&gt; F \ / D1 -&gt; D2 ----/ </code></pre> <p>The ordering of commits is done by "topo-order" or "date-order" (see <a href="http://book.git-scm.com/3_reviewing_history_-_git_log.html" rel="noreferrer">GitPro book</a>)</p> <p>But since <a href="http://kerneltrap.org/node/16515" rel="noreferrer">Git1.6.0</a>, you can list the children of a commit.</p> <pre><code>git rev-list --children git log --children </code></pre> <hr> <p>Note: for <a href="http://progit.org/book/ch6-1.html" rel="noreferrer">parent commits</a>, you have the same issue, with the suffix <code>^</code> to a revision parameter meaning the <em>first</em> parent of that commit object. <code>^&lt;n&gt;</code> means the <code>&lt;n&gt;</code>th parent (i.e. <code>rev^</code> is equivalent to <code>rev^1</code>).</p> <p>If you are on branch <code>foo</code> and issue "<code>git merge bar</code>" then <code>foo</code> will be the first parent.<br> I.e: The first parent is the branch you were on when you merged, and the second is the commit on the branch that you merged in.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload