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 | |
#Example usage: linear-git-history.sh HEAD FETCH_HEAD | |
prev_commit=$1 | |
end_commit=$2 | |
git log --pretty=format:"%h%n" --ancestry-path --reverse $prev_commit..$end_commit | while read commit; do | |
if [ -n "$commit" ]; then | |
#We need to make sure the commit is a direct child of the previous commit. | |
is_direct_child=$(git show -s --pretty=format:"%P" $commit | grep $prev_commit) |