Skip to content

Instantly share code, notes, and snippets.

@innocarpe
Last active March 26, 2023 13:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save innocarpe/546d34a86821829dd6fa11c8064e9f59 to your computer and use it in GitHub Desktop.
Save innocarpe/546d34a86821829dd6fa11c8064e9f59 to your computer and use it in GitHub Desktop.
(non-interactive) interactive rebase with autosquash in short command
#!/bin/bash
# This runs (non-interactive) interactive rebase with autosquash in short command.
# 1. Move this file to ~/.gitsh/
# 2. Add directory path($YOUR_HOME_PATH/.gitsh) to environment variable file
# (like ~/.bash_profile or ~/.zshrc)
# (This would be like 'export PATH=${PATH}:/Users/YOUR_HOME_PATH/.gitsh')
# 3. chmod 0755 git-rif
# 4. Use the command 'git ri COMMIT_HASH'
commit_hash=$1
GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash $commit_hash~1
@christian-elsee
Copy link

I don't know why this was so hard to find, and I am looking at you google, but thank you for this @innocarpe

@innocarpe
Copy link
Author

I don't know why this was so hard to find, and I am looking at you google, but thank you for this @innocarpe

Thanks. Hope it will be helpful ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment