How can I get list of branches emerging from any branch in git?











up vote
3
down vote

favorite












How can I get list of branches emerging from any branch in git ?



Also what is the difference between fetch and pull command in git ?










share|improve this question


























    up vote
    3
    down vote

    favorite












    How can I get list of branches emerging from any branch in git ?



    Also what is the difference between fetch and pull command in git ?










    share|improve this question
























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      How can I get list of branches emerging from any branch in git ?



      Also what is the difference between fetch and pull command in git ?










      share|improve this question













      How can I get list of branches emerging from any branch in git ?



      Also what is the difference between fetch and pull command in git ?







      git






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 3 '09 at 21:36









      Rachel

      37.4k99237346




      37.4k99237346
























          3 Answers
          3






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          git fetch
          git checkout <branch of interest>
          git log --children <commit>


          will print a list of descendant commits for a given one which partially answers your question.



          pull does fetch and attempts to merge



          fetch does not merge






          share|improve this answer























          • I am very new to git and not familiar with the usage of git log --children <commit> command. Is there any I can gain understanding of this.
            – Rachel
            Dec 3 '09 at 22:00










          • instead of <commit> just put the SHA signature - the commit id
            – Evgeny
            Dec 3 '09 at 22:24


















          up vote
          2
          down vote














          How can I get list of branches emerging from any branch in git ?




          Depending on what you mean here by "emerging" (and assuming that you meant "given branch" not "any branch"), it would be either git branch --contains <branch>, or git branch --merged <branch>.



          Fro git-branch manpage:




          SYNOPSIS
          git branch [--color | --no-color] [-r | -a]
          [-v [--abbrev=<length> | --no-abbrev]]
          [(--merged | --no-merged | --contains) [<commit>]]
          DESCRIPTION



          With --contains, shows only the branches that contain the named commit (in other words, the branches whose tip commits are
          descendants of the named commit). With --merged, only branches merged into the named commit (i.e. the branches whose tip
          commits are reachable from the named commit) will be listed. With --no-merged only branches not merged into the named
          commit will be listed. If the argument is missing it defaults to HEAD (i.e. the tip of the current branch).







          share|improve this answer




























            up vote
            0
            down vote













            The second question is easier. A fetch merely updates the remote racking branches of your current repository from a remote repository (usually the origin), a pull performs a fetch and then merges a remote branch into the currently checked out branch. The exact branches fetched and merged can depend on the config, but git tries to "do the right thing" and succeeds in most common setups.



            The first question is a bit more tricky because new branches can be created at any point in any repository from any commit in any given branch's history. In many repositories, most 'normal' branches are all offshoots of each other in some way.



            What you can do is look at all branches git branch, git branch -a or git show-ref --heads for a more scriptable version, and see how the branches relate with a symmertic difference.



            git log --oneline --left-right branch-a...branch-b


            This will show the commits that are not common between the two branches, prefixing them with a < or > to show which branch they are on.






            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














               

              draft saved


              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f1843092%2fhow-can-i-get-list-of-branches-emerging-from-any-branch-in-git%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              3
              down vote



              accepted










              git fetch
              git checkout <branch of interest>
              git log --children <commit>


              will print a list of descendant commits for a given one which partially answers your question.



              pull does fetch and attempts to merge



              fetch does not merge






              share|improve this answer























              • I am very new to git and not familiar with the usage of git log --children <commit> command. Is there any I can gain understanding of this.
                – Rachel
                Dec 3 '09 at 22:00










              • instead of <commit> just put the SHA signature - the commit id
                – Evgeny
                Dec 3 '09 at 22:24















              up vote
              3
              down vote



              accepted










              git fetch
              git checkout <branch of interest>
              git log --children <commit>


              will print a list of descendant commits for a given one which partially answers your question.



              pull does fetch and attempts to merge



              fetch does not merge






              share|improve this answer























              • I am very new to git and not familiar with the usage of git log --children <commit> command. Is there any I can gain understanding of this.
                – Rachel
                Dec 3 '09 at 22:00










              • instead of <commit> just put the SHA signature - the commit id
                – Evgeny
                Dec 3 '09 at 22:24













              up vote
              3
              down vote



              accepted







              up vote
              3
              down vote



              accepted






              git fetch
              git checkout <branch of interest>
              git log --children <commit>


              will print a list of descendant commits for a given one which partially answers your question.



              pull does fetch and attempts to merge



              fetch does not merge






              share|improve this answer














              git fetch
              git checkout <branch of interest>
              git log --children <commit>


              will print a list of descendant commits for a given one which partially answers your question.



              pull does fetch and attempts to merge



              fetch does not merge







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Dec 3 '09 at 22:25

























              answered Dec 3 '09 at 21:40









              Evgeny

              7,89964565




              7,89964565












              • I am very new to git and not familiar with the usage of git log --children <commit> command. Is there any I can gain understanding of this.
                – Rachel
                Dec 3 '09 at 22:00










              • instead of <commit> just put the SHA signature - the commit id
                – Evgeny
                Dec 3 '09 at 22:24


















              • I am very new to git and not familiar with the usage of git log --children <commit> command. Is there any I can gain understanding of this.
                – Rachel
                Dec 3 '09 at 22:00










              • instead of <commit> just put the SHA signature - the commit id
                – Evgeny
                Dec 3 '09 at 22:24
















              I am very new to git and not familiar with the usage of git log --children <commit> command. Is there any I can gain understanding of this.
              – Rachel
              Dec 3 '09 at 22:00




              I am very new to git and not familiar with the usage of git log --children <commit> command. Is there any I can gain understanding of this.
              – Rachel
              Dec 3 '09 at 22:00












              instead of <commit> just put the SHA signature - the commit id
              – Evgeny
              Dec 3 '09 at 22:24




              instead of <commit> just put the SHA signature - the commit id
              – Evgeny
              Dec 3 '09 at 22:24












              up vote
              2
              down vote














              How can I get list of branches emerging from any branch in git ?




              Depending on what you mean here by "emerging" (and assuming that you meant "given branch" not "any branch"), it would be either git branch --contains <branch>, or git branch --merged <branch>.



              Fro git-branch manpage:




              SYNOPSIS
              git branch [--color | --no-color] [-r | -a]
              [-v [--abbrev=<length> | --no-abbrev]]
              [(--merged | --no-merged | --contains) [<commit>]]
              DESCRIPTION



              With --contains, shows only the branches that contain the named commit (in other words, the branches whose tip commits are
              descendants of the named commit). With --merged, only branches merged into the named commit (i.e. the branches whose tip
              commits are reachable from the named commit) will be listed. With --no-merged only branches not merged into the named
              commit will be listed. If the argument is missing it defaults to HEAD (i.e. the tip of the current branch).







              share|improve this answer

























                up vote
                2
                down vote














                How can I get list of branches emerging from any branch in git ?




                Depending on what you mean here by "emerging" (and assuming that you meant "given branch" not "any branch"), it would be either git branch --contains <branch>, or git branch --merged <branch>.



                Fro git-branch manpage:




                SYNOPSIS
                git branch [--color | --no-color] [-r | -a]
                [-v [--abbrev=<length> | --no-abbrev]]
                [(--merged | --no-merged | --contains) [<commit>]]
                DESCRIPTION



                With --contains, shows only the branches that contain the named commit (in other words, the branches whose tip commits are
                descendants of the named commit). With --merged, only branches merged into the named commit (i.e. the branches whose tip
                commits are reachable from the named commit) will be listed. With --no-merged only branches not merged into the named
                commit will be listed. If the argument is missing it defaults to HEAD (i.e. the tip of the current branch).







                share|improve this answer























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote










                  How can I get list of branches emerging from any branch in git ?




                  Depending on what you mean here by "emerging" (and assuming that you meant "given branch" not "any branch"), it would be either git branch --contains <branch>, or git branch --merged <branch>.



                  Fro git-branch manpage:




                  SYNOPSIS
                  git branch [--color | --no-color] [-r | -a]
                  [-v [--abbrev=<length> | --no-abbrev]]
                  [(--merged | --no-merged | --contains) [<commit>]]
                  DESCRIPTION



                  With --contains, shows only the branches that contain the named commit (in other words, the branches whose tip commits are
                  descendants of the named commit). With --merged, only branches merged into the named commit (i.e. the branches whose tip
                  commits are reachable from the named commit) will be listed. With --no-merged only branches not merged into the named
                  commit will be listed. If the argument is missing it defaults to HEAD (i.e. the tip of the current branch).







                  share|improve this answer













                  How can I get list of branches emerging from any branch in git ?




                  Depending on what you mean here by "emerging" (and assuming that you meant "given branch" not "any branch"), it would be either git branch --contains <branch>, or git branch --merged <branch>.



                  Fro git-branch manpage:




                  SYNOPSIS
                  git branch [--color | --no-color] [-r | -a]
                  [-v [--abbrev=<length> | --no-abbrev]]
                  [(--merged | --no-merged | --contains) [<commit>]]
                  DESCRIPTION



                  With --contains, shows only the branches that contain the named commit (in other words, the branches whose tip commits are
                  descendants of the named commit). With --merged, only branches merged into the named commit (i.e. the branches whose tip
                  commits are reachable from the named commit) will be listed. With --no-merged only branches not merged into the named
                  commit will be listed. If the argument is missing it defaults to HEAD (i.e. the tip of the current branch).








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 4 '09 at 8:32









                  Jakub Narębski

                  208k55194222




                  208k55194222






















                      up vote
                      0
                      down vote













                      The second question is easier. A fetch merely updates the remote racking branches of your current repository from a remote repository (usually the origin), a pull performs a fetch and then merges a remote branch into the currently checked out branch. The exact branches fetched and merged can depend on the config, but git tries to "do the right thing" and succeeds in most common setups.



                      The first question is a bit more tricky because new branches can be created at any point in any repository from any commit in any given branch's history. In many repositories, most 'normal' branches are all offshoots of each other in some way.



                      What you can do is look at all branches git branch, git branch -a or git show-ref --heads for a more scriptable version, and see how the branches relate with a symmertic difference.



                      git log --oneline --left-right branch-a...branch-b


                      This will show the commits that are not common between the two branches, prefixing them with a < or > to show which branch they are on.






                      share|improve this answer

























                        up vote
                        0
                        down vote













                        The second question is easier. A fetch merely updates the remote racking branches of your current repository from a remote repository (usually the origin), a pull performs a fetch and then merges a remote branch into the currently checked out branch. The exact branches fetched and merged can depend on the config, but git tries to "do the right thing" and succeeds in most common setups.



                        The first question is a bit more tricky because new branches can be created at any point in any repository from any commit in any given branch's history. In many repositories, most 'normal' branches are all offshoots of each other in some way.



                        What you can do is look at all branches git branch, git branch -a or git show-ref --heads for a more scriptable version, and see how the branches relate with a symmertic difference.



                        git log --oneline --left-right branch-a...branch-b


                        This will show the commits that are not common between the two branches, prefixing them with a < or > to show which branch they are on.






                        share|improve this answer























                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          The second question is easier. A fetch merely updates the remote racking branches of your current repository from a remote repository (usually the origin), a pull performs a fetch and then merges a remote branch into the currently checked out branch. The exact branches fetched and merged can depend on the config, but git tries to "do the right thing" and succeeds in most common setups.



                          The first question is a bit more tricky because new branches can be created at any point in any repository from any commit in any given branch's history. In many repositories, most 'normal' branches are all offshoots of each other in some way.



                          What you can do is look at all branches git branch, git branch -a or git show-ref --heads for a more scriptable version, and see how the branches relate with a symmertic difference.



                          git log --oneline --left-right branch-a...branch-b


                          This will show the commits that are not common between the two branches, prefixing them with a < or > to show which branch they are on.






                          share|improve this answer












                          The second question is easier. A fetch merely updates the remote racking branches of your current repository from a remote repository (usually the origin), a pull performs a fetch and then merges a remote branch into the currently checked out branch. The exact branches fetched and merged can depend on the config, but git tries to "do the right thing" and succeeds in most common setups.



                          The first question is a bit more tricky because new branches can be created at any point in any repository from any commit in any given branch's history. In many repositories, most 'normal' branches are all offshoots of each other in some way.



                          What you can do is look at all branches git branch, git branch -a or git show-ref --heads for a more scriptable version, and see how the branches relate with a symmertic difference.



                          git log --oneline --left-right branch-a...branch-b


                          This will show the commits that are not common between the two branches, prefixing them with a < or > to show which branch they are on.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 3 '09 at 21:55









                          CB Bailey

                          503k77546606




                          503k77546606






























                               

                              draft saved


                              draft discarded



















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f1843092%2fhow-can-i-get-list-of-branches-emerging-from-any-branch-in-git%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Paul Cézanne

                              UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

                              Angular material date-picker (MatDatepicker) auto completes the date on focus out