This VS Code extension adds Git options to the Explorer context menu.
- Adds a "Git" option to the right-click context menu in the Explorer
- Includes submenu with the following Git operations:
- Commit File (opens Source Control view)
- +Add (adds untracked files or directories to git)
- Annotate With Git Blame
- Show Diff
- Compare with Revision
- Compare With Branch Or Tag
- Show History
- Rollback
- Push
- Pull
- Fetch
- Merge
- Rebase
- Abort
- +New Branch
- New Tag
- Clone this repository
- Run
npm install
to install dependencies - Run
npm run compile
to compile the TypeScript code - Open the project in VS Code
- Press
F5
to launch the extension in a new Extension Development Host window
- Right-click on any file in the Explorer
- Select "Git" from the context menu
- Choose from the available Git operations:
- Commit File: Opens the Source Control view in VS Code
- +Add: Adds untracked files or directories to git. Only available for files or directories not yet tracked by git. When selected, the file or all files in the directory will be added to git management.
- Annotate With Git Blame: Shows git blame annotations for the selected file
- Show Diff: Shows the diff for the selected file
- Compare with Revision: Compares the selected file with a specific revision
- Compare With Branch Or Tag: Compares the selected file with a branch or tag
- Show History: Shows the git history for the selected file
- Show Current Revision: Shows the current revision of the selected file
- Rollback: Rolls back the selected file to a previous revision
- Push: Pushes changes to the remote repository
- Pull: Pulls changes from the remote repository
- Fetch: Fetches changes from the remote repository
- Merge: Merges changes from another branch
- Rebase: Rebases the current branch on top of another branch
- Abort: Aborts a conflicting rebase or merge operation
- +New Branch: Creates a new branch and switches to it. Prompts the user for the branch name.
- New Tag: Creates a new tag. Prompts the user for the tag name.
- Install dependencies:
npm install
- Compile TypeScript:
npm run compile
- Run the extension in VS Code debugger
Note: The actual Git functionality is not implemented in this basic version and would require integration with Git commands or libraries.
The extension is implemented in TypeScript and compiled to JavaScript. The key files are:
package.json
: Extension manifest file that defines the extension's metadata, contributes commands and menussrc/extension.ts
: Main extension file that registers commands and implements functionalitytsconfig.json
: TypeScript configuration file