Squash commits without repetitive conflicts
Shell Makefile HTML
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
docs
etc
man
test
.gitignore
.travis.yml
CHANGELOG.md
Makefile
README.md
UNLICENSE
support.html

README.md

git-sqwish Build status

Squash commits without repetitive conflicts

Designed for use with git merge during development and avoid git rebase's repetitive conflicts altogether.

Screenshot walkthrough. Plain text available at https://github.com/twolfson/git-sqwish/blob/290c35bcbe418aed7bcbc957e5a8b0790cd72dad/README.md

Installation

One line install:

(cd /tmp && git clone --depth 1 https://github.com/twolfson/git-sqwish && cd git-sqwish && sudo make install)

Manual install:

$ # Clone the repository
$ git clone --depth 1 https://github.com/twolfson/git-sqwish
Cloning into 'git-sqwish'...
...
Resolving deltas: 100% (13/13), done.
$ # Go into the directory
$ cd git-sqwish
$ # Install the script
$ sudo make install
... installing bins to /usr/local/bin
... installing man pages to /usr/local/share/man/man1
... installing git-sqwish
cp -f man/git-*.1 "/usr/local/share/man/man1"
cp -f etc/bash_completion.sh /etc/bash_completion.d/git-sqwish
$ git sqwish # Now available for invocation

Architecture

git-sqwish takes the same vision as your normal squash technique (git rebase + git rebase -i). The end goal is to have all applied changes on top of the latest master branch. The high level details are:

  1. Verify current branch is clean
  2. Verify current branch is ahead of master and won't conflict with a dry merge
  3. Checkout .sqwished branch based off of master
  4. Copy state of files from original branch to .sqwished branch
  5. Collect commit messages from original branch into collective commit message
  6. If message was not provided, open commit prompt with collective message
  7. Commit changes to .sqwished branch

FAQs

Can we squash changes without moving to a new branch?

A secondary branch is always required for this approach. However, git-extras implements a git-squash that returns to the original branch.

git squash --me

Attribution

man/Readme.md, man/manning-up.sh, and Makefile are forked from git-extras, a broader collection of git utilities. Those files are licensed under the MIT License.

Donating

Support this project and others by twolfson via gittip.

Support via Gittip

Unlicense

As of Sep 24 2013, Todd Wolfson has released this repository and its unattributed contents to the public domain.

It has been released under the UNLICENSE.