Pull request on a branch which got cherry picked commits merged











up vote
2
down vote

favorite
1












I initiated a feature development in BranchA, but I included some 'clean up' and 'tweaking' commits on it.



In the middle of the process 'tweaking' commits needed to be merged into the master (by doing a pull request) so I created a BranchB with some new commits and cherry picked some of the commits done in BranchA.

BranchB was merged with no conflicts.



My question is: How to handle the BranchA pull request?

Is it safe to submit BranchA even if some of its commits were already merged? If not, how to go through this situation?



Situation










share|improve this question




























    up vote
    2
    down vote

    favorite
    1












    I initiated a feature development in BranchA, but I included some 'clean up' and 'tweaking' commits on it.



    In the middle of the process 'tweaking' commits needed to be merged into the master (by doing a pull request) so I created a BranchB with some new commits and cherry picked some of the commits done in BranchA.

    BranchB was merged with no conflicts.



    My question is: How to handle the BranchA pull request?

    Is it safe to submit BranchA even if some of its commits were already merged? If not, how to go through this situation?



    Situation










    share|improve this question


























      up vote
      2
      down vote

      favorite
      1









      up vote
      2
      down vote

      favorite
      1






      1





      I initiated a feature development in BranchA, but I included some 'clean up' and 'tweaking' commits on it.



      In the middle of the process 'tweaking' commits needed to be merged into the master (by doing a pull request) so I created a BranchB with some new commits and cherry picked some of the commits done in BranchA.

      BranchB was merged with no conflicts.



      My question is: How to handle the BranchA pull request?

      Is it safe to submit BranchA even if some of its commits were already merged? If not, how to go through this situation?



      Situation










      share|improve this question















      I initiated a feature development in BranchA, but I included some 'clean up' and 'tweaking' commits on it.



      In the middle of the process 'tweaking' commits needed to be merged into the master (by doing a pull request) so I created a BranchB with some new commits and cherry picked some of the commits done in BranchA.

      BranchB was merged with no conflicts.



      My question is: How to handle the BranchA pull request?

      Is it safe to submit BranchA even if some of its commits were already merged? If not, how to go through this situation?



      Situation







      git github rebase git-cherry-pick






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 at 1:28









      VonC

      822k28425813100




      822k28425813100










      asked Nov 9 at 21:59









      NirajBlue

      155




      155
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Rebase branch A on B: only the commits not cherry-picked should be there.



           B--B--B--B--A'--A'--A' (A)

          m--M--m--m (master)


          Then rebase A on top of master:



          git rebase --onto master B A


          That will rebase all commits after B HEAD, up to A HEAD (included).



           B--B--B--B (B)

          m--M--m--m (master)

          A''--A''--A'' (A)


          From there, you can make your pull-request.






          share|improve this answer





















          • I did it like this: git checkout master && git fetch upstream && git merge upstream/master && git checkout BranchA && git rebase BranchB && git rebase master
            – NirajBlue
            Nov 12 at 19:27










          • @NirajBlue That should work, well done.
            – VonC
            Nov 12 at 20:07













          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%2f53233783%2fpull-request-on-a-branch-which-got-cherry-picked-commits-merged%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          Rebase branch A on B: only the commits not cherry-picked should be there.



           B--B--B--B--A'--A'--A' (A)

          m--M--m--m (master)


          Then rebase A on top of master:



          git rebase --onto master B A


          That will rebase all commits after B HEAD, up to A HEAD (included).



           B--B--B--B (B)

          m--M--m--m (master)

          A''--A''--A'' (A)


          From there, you can make your pull-request.






          share|improve this answer





















          • I did it like this: git checkout master && git fetch upstream && git merge upstream/master && git checkout BranchA && git rebase BranchB && git rebase master
            – NirajBlue
            Nov 12 at 19:27










          • @NirajBlue That should work, well done.
            – VonC
            Nov 12 at 20:07

















          up vote
          2
          down vote



          accepted










          Rebase branch A on B: only the commits not cherry-picked should be there.



           B--B--B--B--A'--A'--A' (A)

          m--M--m--m (master)


          Then rebase A on top of master:



          git rebase --onto master B A


          That will rebase all commits after B HEAD, up to A HEAD (included).



           B--B--B--B (B)

          m--M--m--m (master)

          A''--A''--A'' (A)


          From there, you can make your pull-request.






          share|improve this answer





















          • I did it like this: git checkout master && git fetch upstream && git merge upstream/master && git checkout BranchA && git rebase BranchB && git rebase master
            – NirajBlue
            Nov 12 at 19:27










          • @NirajBlue That should work, well done.
            – VonC
            Nov 12 at 20:07















          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          Rebase branch A on B: only the commits not cherry-picked should be there.



           B--B--B--B--A'--A'--A' (A)

          m--M--m--m (master)


          Then rebase A on top of master:



          git rebase --onto master B A


          That will rebase all commits after B HEAD, up to A HEAD (included).



           B--B--B--B (B)

          m--M--m--m (master)

          A''--A''--A'' (A)


          From there, you can make your pull-request.






          share|improve this answer












          Rebase branch A on B: only the commits not cherry-picked should be there.



           B--B--B--B--A'--A'--A' (A)

          m--M--m--m (master)


          Then rebase A on top of master:



          git rebase --onto master B A


          That will rebase all commits after B HEAD, up to A HEAD (included).



           B--B--B--B (B)

          m--M--m--m (master)

          A''--A''--A'' (A)


          From there, you can make your pull-request.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 10 at 1:27









          VonC

          822k28425813100




          822k28425813100












          • I did it like this: git checkout master && git fetch upstream && git merge upstream/master && git checkout BranchA && git rebase BranchB && git rebase master
            – NirajBlue
            Nov 12 at 19:27










          • @NirajBlue That should work, well done.
            – VonC
            Nov 12 at 20:07




















          • I did it like this: git checkout master && git fetch upstream && git merge upstream/master && git checkout BranchA && git rebase BranchB && git rebase master
            – NirajBlue
            Nov 12 at 19:27










          • @NirajBlue That should work, well done.
            – VonC
            Nov 12 at 20:07


















          I did it like this: git checkout master && git fetch upstream && git merge upstream/master && git checkout BranchA && git rebase BranchB && git rebase master
          – NirajBlue
          Nov 12 at 19:27




          I did it like this: git checkout master && git fetch upstream && git merge upstream/master && git checkout BranchA && git rebase BranchB && git rebase master
          – NirajBlue
          Nov 12 at 19:27












          @NirajBlue That should work, well done.
          – VonC
          Nov 12 at 20:07






          @NirajBlue That should work, well done.
          – VonC
          Nov 12 at 20:07




















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233783%2fpull-request-on-a-branch-which-got-cherry-picked-commits-merged%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

          How to pass form data using jquery Ajax to insert data in database?

          National Museum of Racing and Hall of Fame

          Guess what letter conforming each word