A VS Code extension that simplifies Git workflow by helping developers squash multiple commits before pushing to a remote repository.
Features
🔍 Automatically identifies your current Git branch
🔄 Detects upstream branch configuration
📋 Lists local commits that haven't been pushed yet
✅ Interactive UI to select base commit for squashing operations
🔄 Performs squash operation with a single command
Installation
Launch VS Code
Go to Extensions view (Ctrl+Shift+X / Cmd+Shift+X)
Search for "Squash-Push"
Click Install
Usage
Open a Git repository in VS Code
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
Type "Squash Local Commits" OR "Squash-Push: Squash Local Commits" and select the command
Select the oldest commit you want to keep as the base for squashing
The extension will squash your commits and open the commit message editor
Save your new commit message and push your changes
Requirements
Git must be installed and available in your PATH
VS Code 1.60 or higher
Extension Settings
This extension doesn't add any VS Code settings yet. Future versions may include:
Custom commit message templates
Auto-push option after squashing
Branch protection settings
Known Issues
Cannot squash onto the root commit (first commit in repository)
May encounter issues with merge commits
Development
Setup
# Clone the repository
git clone https://github.com/yourusername/squash-push.git
# Navigate to the project directory
cd squash-push
# Install dependencies
npm install
# Open in VS Code
code .
Build and Run
Press F5 to start debugging
Run npm run compile to compile the TypeScript code
Run npm run watch to watch for file changes during development
Testing
npm test
Technical Documentation
Core Functions
The extension provides several utility functions for Git operations:
execGitCommand: Executes Git commands and returns results as promises
getCurrentBranch: Gets the name of the current Git branch
getCurrentUpStreamBranch: Determines the upstream branch for the current branch
getLocalCommits: Retrieves a list of local commits
hasParent: Checks if a commit has a parent commit
showCommitSelections: Displays UI for selecting commits
getCommitID: Extracts and validates the selected commit ID