A VS Code extension that simplifies Git workflow by helping developers squash multiple commits before pushing to a remote repository.
- 🔍 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
- Launch VS Code
- Go to Extensions view (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Squash-Push"
- Click Install
- 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
- Git must be installed and available in your PATH
- VS Code 1.60 or higher
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
- Cannot squash onto the root commit (first commit in repository)
- May encounter issues with merge commits
# 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 .- Press F5 to start debugging
- Run
npm run compileto compile the TypeScript code - Run
npm run watchto watch for file changes during development
npm testThe extension provides several utility functions for Git operations:
execGitCommand: Executes Git commands and returns results as promisesgetCurrentBranch: Gets the name of the current Git branchgetCurrentUpStreamBranch: Determines the upstream branch for the current branchgetLocalCommits: Retrieves a list of local commitshasParent: Checks if a commit has a parent commitshowCommitSelections: Displays UI for selecting commitsgetCommitID: Extracts and validates the selected commit ID
For detailed API documentation, see DOCUMENTATION.md.
The extension handles several error conditions:
- No workspace folder found
- Detached HEAD state
- No local commits found
- Multiple commits selected as base (only one is allowed)
- Attempting to squash onto a root commit
- Errors during the squash operation
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Support for multiple workspace folders
- Interactive rebase option
- Custom commit message templates
- Automatic push after squash
- Branch protection rules
- Undo squash operation
This project is licensed under the MIT License - see the LICENSE file for details.
- VS Code Extension API documentation
- Git documentation
