Last active
December 17, 2015 06:28
-
-
Save daragh/5565623 to your computer and use it in GitHub Desktop.
A bash script to show the commit that git is trying to apply a patch for in a rebase/apply.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
git_dir=$(git rev-parse --git-dir) | |
rebase_dir=$git_dir/rebase-apply | |
if [ ! -d $rebase_dir ] | |
then | |
echo 'rebase/apply not in progress' >&2 | |
exit 1 | |
fi | |
patch_number=$(cat $rebase_dir/next) | |
padded_patch_number=$(printf %04d $patch_number) | |
commit_id=$(head -n 1 $rebase_dir/$padded_patch_number | cut -d ' ' -f 2) | |
git show $commit_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment