-
Notifications
You must be signed in to change notification settings - Fork 37.3k
Add Git: Delete action to run git rm command on the current document
#285411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new Git: Delete command that allows users to delete files from a Git repository using the git rm command, invoked from the currently open editor. The command includes safety checks to prevent accidental deletion of files with uncommitted changes and provides a confirmation dialog (configurable via the new git.confirmCommittedDelete setting).
Key changes:
- Implements the
git.deletecommand that runsgit rmon the current document and closes the editor if not dirty - Adds a confirmation dialog with customizable setting
git.confirmCommittedDelete(default: true) - Validates that files have no uncommitted changes before allowing deletion
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
extensions/git/src/commands.ts |
Implements the new delete command with uncommitted changes check, confirmation dialog, git rm execution, and editor closing logic |
extensions/git/package.nls.json |
Adds localized strings for the "Delete" command name and the "confirmCommittedDelete" configuration description |
extensions/git/package.json |
Registers the git.delete command with menu contribution and adds the git.confirmCommittedDelete boolean configuration setting |
Co-authored-by: Copilot <[email protected]>
Fixes #111767
Added
Git: Deletecommand which operates on the currently opened editor and runsgit rmon the file, then closes the editor (if it is not dirty).Added
git.confirmCommittedDeletesetting (on by default) to turn off the confirmation.NOTE Since public API has no way to add a checkbox to the confirmation dialog, the setting can only be turned off from the settings file/UI.