You can clone with
#Example usage: linear-git-history.sh HEAD FETCH_HEAD
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)
if [ ! -z "$is_direct_child" ] ; then
echo "The commit is not a direct decendant of $prev_commit"