Git force delete with lowercase -d in VSCode











up vote
1
down vote

favorite
1












We're using git and VSCode with the GitLens extension to handle source control. We're also using a pull request mechanism to merge branches back into master on the remote side, and all of this is working great.



However this means that when I create a branch locally to do the pull request, my local branch is never technically merged directly back into the branch that it was created from in my local environment, and in fact cannot be since we have protocols preventing a direct update to master without a pull request.



This isn't a big problem except when everything is complete and I try to delete the branch by using GitLens, the command it puts into the terminal is git branch -d [branch name], which then of course gives the error that the branch is not fully merged, even though the remote has in fact been merged back to master successfully at this point.



Since GitLens outputs the command to the terminal and allows you to execute it, I can change it to the uppercase -D, but this is becoming a bit of a repetitive pain for my team that I'd like to find a solution to prevent.



Is there a way to either change the behavior of the GitLens extension to use an uppercase -D, or to have git treat the lowercase as an uppercase, or some other way to easily delete a local branch without so much extra work?



Thanks in advance!










share|improve this question




























    up vote
    1
    down vote

    favorite
    1












    We're using git and VSCode with the GitLens extension to handle source control. We're also using a pull request mechanism to merge branches back into master on the remote side, and all of this is working great.



    However this means that when I create a branch locally to do the pull request, my local branch is never technically merged directly back into the branch that it was created from in my local environment, and in fact cannot be since we have protocols preventing a direct update to master without a pull request.



    This isn't a big problem except when everything is complete and I try to delete the branch by using GitLens, the command it puts into the terminal is git branch -d [branch name], which then of course gives the error that the branch is not fully merged, even though the remote has in fact been merged back to master successfully at this point.



    Since GitLens outputs the command to the terminal and allows you to execute it, I can change it to the uppercase -D, but this is becoming a bit of a repetitive pain for my team that I'd like to find a solution to prevent.



    Is there a way to either change the behavior of the GitLens extension to use an uppercase -D, or to have git treat the lowercase as an uppercase, or some other way to easily delete a local branch without so much extra work?



    Thanks in advance!










    share|improve this question


























      up vote
      1
      down vote

      favorite
      1









      up vote
      1
      down vote

      favorite
      1






      1





      We're using git and VSCode with the GitLens extension to handle source control. We're also using a pull request mechanism to merge branches back into master on the remote side, and all of this is working great.



      However this means that when I create a branch locally to do the pull request, my local branch is never technically merged directly back into the branch that it was created from in my local environment, and in fact cannot be since we have protocols preventing a direct update to master without a pull request.



      This isn't a big problem except when everything is complete and I try to delete the branch by using GitLens, the command it puts into the terminal is git branch -d [branch name], which then of course gives the error that the branch is not fully merged, even though the remote has in fact been merged back to master successfully at this point.



      Since GitLens outputs the command to the terminal and allows you to execute it, I can change it to the uppercase -D, but this is becoming a bit of a repetitive pain for my team that I'd like to find a solution to prevent.



      Is there a way to either change the behavior of the GitLens extension to use an uppercase -D, or to have git treat the lowercase as an uppercase, or some other way to easily delete a local branch without so much extra work?



      Thanks in advance!










      share|improve this question















      We're using git and VSCode with the GitLens extension to handle source control. We're also using a pull request mechanism to merge branches back into master on the remote side, and all of this is working great.



      However this means that when I create a branch locally to do the pull request, my local branch is never technically merged directly back into the branch that it was created from in my local environment, and in fact cannot be since we have protocols preventing a direct update to master without a pull request.



      This isn't a big problem except when everything is complete and I try to delete the branch by using GitLens, the command it puts into the terminal is git branch -d [branch name], which then of course gives the error that the branch is not fully merged, even though the remote has in fact been merged back to master successfully at this point.



      Since GitLens outputs the command to the terminal and allows you to execute it, I can change it to the uppercase -D, but this is becoming a bit of a repetitive pain for my team that I'd like to find a solution to prevent.



      Is there a way to either change the behavior of the GitLens extension to use an uppercase -D, or to have git treat the lowercase as an uppercase, or some other way to easily delete a local branch without so much extra work?



      Thanks in advance!







      git version-control visual-studio-code






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 at 22:43

























      asked Nov 14 at 22:38









      Will P.

      5,60732033




      5,60732033
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          If you pull master so that the pull request is on your local computer lowercase d it should work.



          Alternatively you could modify code in the extension and change it to an argument that deletes the branch locally without knowledge of a pull request.






          share|improve this answer





















          • This doesn't seem to work. I think the problem is that one of our merge policies is that when the pull request is completed, the remote branch is deleted automatically to reduce clutter. I think that branch is what would need to be pulled down. I'll tweak the policy so I can test this theory with my next PR
            – Will P.
            Nov 15 at 20:05










          • Ok, so deleting the local branch before the remote seems to work. It does give a warning that the branch I'm deleting hasn't been merged to the head, but it does do the deletion. However that leaves me with the extra step of deleting the remote branch, so I think there's not really a great solution besides rewriting the extension with a capital D, which I'm not really inclined to want to do, since maintaining that would not be great. So I think we'll just have to live with the current behavior unfortunately. Thanks
            – Will P.
            Nov 15 at 21:52











          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%2f53309784%2fgit-force-delete-with-lowercase-d-in-vscode%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
          0
          down vote



          accepted










          If you pull master so that the pull request is on your local computer lowercase d it should work.



          Alternatively you could modify code in the extension and change it to an argument that deletes the branch locally without knowledge of a pull request.






          share|improve this answer





















          • This doesn't seem to work. I think the problem is that one of our merge policies is that when the pull request is completed, the remote branch is deleted automatically to reduce clutter. I think that branch is what would need to be pulled down. I'll tweak the policy so I can test this theory with my next PR
            – Will P.
            Nov 15 at 20:05










          • Ok, so deleting the local branch before the remote seems to work. It does give a warning that the branch I'm deleting hasn't been merged to the head, but it does do the deletion. However that leaves me with the extra step of deleting the remote branch, so I think there's not really a great solution besides rewriting the extension with a capital D, which I'm not really inclined to want to do, since maintaining that would not be great. So I think we'll just have to live with the current behavior unfortunately. Thanks
            – Will P.
            Nov 15 at 21:52















          up vote
          0
          down vote



          accepted










          If you pull master so that the pull request is on your local computer lowercase d it should work.



          Alternatively you could modify code in the extension and change it to an argument that deletes the branch locally without knowledge of a pull request.






          share|improve this answer





















          • This doesn't seem to work. I think the problem is that one of our merge policies is that when the pull request is completed, the remote branch is deleted automatically to reduce clutter. I think that branch is what would need to be pulled down. I'll tweak the policy so I can test this theory with my next PR
            – Will P.
            Nov 15 at 20:05










          • Ok, so deleting the local branch before the remote seems to work. It does give a warning that the branch I'm deleting hasn't been merged to the head, but it does do the deletion. However that leaves me with the extra step of deleting the remote branch, so I think there's not really a great solution besides rewriting the extension with a capital D, which I'm not really inclined to want to do, since maintaining that would not be great. So I think we'll just have to live with the current behavior unfortunately. Thanks
            – Will P.
            Nov 15 at 21:52













          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          If you pull master so that the pull request is on your local computer lowercase d it should work.



          Alternatively you could modify code in the extension and change it to an argument that deletes the branch locally without knowledge of a pull request.






          share|improve this answer












          If you pull master so that the pull request is on your local computer lowercase d it should work.



          Alternatively you could modify code in the extension and change it to an argument that deletes the branch locally without knowledge of a pull request.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 at 22:51









          Thomas Carpeggiani

          4615




          4615












          • This doesn't seem to work. I think the problem is that one of our merge policies is that when the pull request is completed, the remote branch is deleted automatically to reduce clutter. I think that branch is what would need to be pulled down. I'll tweak the policy so I can test this theory with my next PR
            – Will P.
            Nov 15 at 20:05










          • Ok, so deleting the local branch before the remote seems to work. It does give a warning that the branch I'm deleting hasn't been merged to the head, but it does do the deletion. However that leaves me with the extra step of deleting the remote branch, so I think there's not really a great solution besides rewriting the extension with a capital D, which I'm not really inclined to want to do, since maintaining that would not be great. So I think we'll just have to live with the current behavior unfortunately. Thanks
            – Will P.
            Nov 15 at 21:52


















          • This doesn't seem to work. I think the problem is that one of our merge policies is that when the pull request is completed, the remote branch is deleted automatically to reduce clutter. I think that branch is what would need to be pulled down. I'll tweak the policy so I can test this theory with my next PR
            – Will P.
            Nov 15 at 20:05










          • Ok, so deleting the local branch before the remote seems to work. It does give a warning that the branch I'm deleting hasn't been merged to the head, but it does do the deletion. However that leaves me with the extra step of deleting the remote branch, so I think there's not really a great solution besides rewriting the extension with a capital D, which I'm not really inclined to want to do, since maintaining that would not be great. So I think we'll just have to live with the current behavior unfortunately. Thanks
            – Will P.
            Nov 15 at 21:52
















          This doesn't seem to work. I think the problem is that one of our merge policies is that when the pull request is completed, the remote branch is deleted automatically to reduce clutter. I think that branch is what would need to be pulled down. I'll tweak the policy so I can test this theory with my next PR
          – Will P.
          Nov 15 at 20:05




          This doesn't seem to work. I think the problem is that one of our merge policies is that when the pull request is completed, the remote branch is deleted automatically to reduce clutter. I think that branch is what would need to be pulled down. I'll tweak the policy so I can test this theory with my next PR
          – Will P.
          Nov 15 at 20:05












          Ok, so deleting the local branch before the remote seems to work. It does give a warning that the branch I'm deleting hasn't been merged to the head, but it does do the deletion. However that leaves me with the extra step of deleting the remote branch, so I think there's not really a great solution besides rewriting the extension with a capital D, which I'm not really inclined to want to do, since maintaining that would not be great. So I think we'll just have to live with the current behavior unfortunately. Thanks
          – Will P.
          Nov 15 at 21:52




          Ok, so deleting the local branch before the remote seems to work. It does give a warning that the branch I'm deleting hasn't been merged to the head, but it does do the deletion. However that leaves me with the extra step of deleting the remote branch, so I think there's not really a great solution besides rewriting the extension with a capital D, which I'm not really inclined to want to do, since maintaining that would not be great. So I think we'll just have to live with the current behavior unfortunately. Thanks
          – Will P.
          Nov 15 at 21:52


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309784%2fgit-force-delete-with-lowercase-d-in-vscode%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 change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents