Git force delete with lowercase -d in VSCode
up vote
1
down vote
favorite
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 |
up vote
1
down vote
favorite
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 |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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 at 22:43
asked Nov 14 at 22:38
Will P.
5,60732033
5,60732033
add a comment |
add a comment |
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.
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
add a comment |
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.
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
add a comment |
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.
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
add a comment |
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.
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 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
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 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
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.
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.
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