Complete the command to show the current branch's commit hash.
cat .git/refs/heads/[1]The branch name is a file inside .git/refs/heads/. Reading it shows the commit hash it points to.
Complete the command to see what HEAD points to.
cat [1]The .git/HEAD file contains a reference to the current branch or commit hash.
Fix the error in the command to read the commit hash of the 'develop' branch.
cat .git/refs/heads/[1]The branch name must be exactly the branch you want to read. 'develop' is a common branch name.
Fill both blanks to show the commit hash that HEAD points to by reading the branch file.
branch=$(cat .git/[1] | cut -d' ' -f2) cat .git/refs/heads/[2]
The first command reads .git/HEAD to get the branch name. The second reads the branch file inside .git/refs/heads/.
Fill both blanks to create a dictionary-like output of branch names and their commit hashes.
for branch in master develop feature; do echo "[1]: $(cat .git/refs/heads/[2])" done
The loop variable is branch. To get each branch's hash, use the variable branch inside the path.