Git force delete with lowercase -d in VSCode
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
add a comment |
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
add a comment |
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
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
git version-control visual-studio-code
edited Nov 14 '18 at 22:43
Will P.
asked Nov 14 '18 at 22:38
Will P.Will P.
5,69932033
5,69932033
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
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 '18 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 '18 at 21:52
add a comment |
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',
autoActivateHeartbeat: false,
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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 '18 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 '18 at 21:52
add a comment |
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.
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 '18 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 '18 at 21:52
add a comment |
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.
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.
answered Nov 14 '18 at 22:51
Thomas CarpeggianiThomas Carpeggiani
4815
4815
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 '18 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 '18 at 21:52
add a comment |
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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 at 21:52
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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