After running git rebase -i master I always wish to write :2,50s/pick/squash/g in the vim window that opens. Is there a way to automate what will be written to vim?
This answer shows how to write vim commands from shell, but the problem is in my case the git commands open up vim, and it's not in my control.
git reset --softto the parent of the first commit and then make one new commit. (The parent of the first commit will probably always begit merge-base master HEAD.)rebaseinstead ofmerge? Apologies if that is a dumb question.mergeorrebase, and instead useresetto effectively squash all of your commits into a single commit. The outcome would be the same as what you're doing with the interactive rebase and squashing all of your commits up into the first one, except with reset you have to write the new commit message yourself. (Compared to with interactive rebase where it will show you the 50 messages at the end and let you edit it, or you can use "f" instead of "s" to avoid that.) Themerge-basecommand was simply to help you find the parent of the first commit to reset back to.git reset --softyou can also create a new branch name and rungit merge --squashto build the same commit you'd build withgit reset --soft. That is, you'll create a new branch based on the merge base commit (perhaps usingmasterdirectly to find it),git switchto the new branch, thengit merge --squash development-branch.