Artificial intelligent assistant

git の tree-ish を tree object の id に変換するには? git tree-ish develop develop^ HEAD develop:some-dir tree object id : `git commit-tree` tree-ish tree object id

@yas @metropolis


#!/bin/sh

if [ $# -ne 1 ]
then
echo "usage: $0 treeish" 1>&2
exit 1
fi

treeish="$1"

case $(git cat-file -t "${treeish}") in
commit)
git cat-file -p "${treeish}" |
sed -n 1p |
awk '{print $2}'
;;
tree)
git rev-parse "${treeish}"
;;
esac

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 73bcdfde9ba04effb1df751cce844bc4