I have commit number. I would like to get previous commit number(parent). I need commits from current branch.
If you only want the ids of the parents of an input commit with id then run this command:
git cat-file -p | awk 'NR > 1 {if(/^parent/){print $2; next}{exit}}'
This will work for normal and shallow clones.