Skip to content

Instantly share code, notes, and snippets.

@innocarpe
Last active September 6, 2019 09:27
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/91cb5aa118a0674a3e4490ab33044e1c to your computer and use it in GitHub Desktop.
Save innocarpe/91cb5aa118a0674a3e4490ab33044e1c to your computer and use it in GitHub Desktop.
Short git command for git interactive rebase (w/ specific commit)
#!/bin/bash
# This runs interactive rebase with autosquash in short command.
# It is equal to `git rebase -i COMMIT_HASH~1`
# 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-ri
# 4. Use the command 'git ri COMMIT_HASH'
commit_hash=$1
git rebase -i --autosquash $commit_hash~1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment