0
0
Gitdevops~10 mins

SHA-1 hashing concept in Git - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to show the SHA-1 hash of a file named example.txt.

Git
git hash-object [1]
Drag options to blanks, or click blank then click option'
Aexample.txt
Bcommit
Cinit
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using git commands unrelated to hashing like 'commit' or 'status'.
Forgetting to specify the file name.
2fill in blank
medium

Complete the command to create a new Git object from the file data.txt and print its SHA-1 hash.

Git
git hash-object -[1] data.txt
Drag options to blanks, or click blank then click option'
Ac
Br
Cw
Dm
Attempts:
3 left
💡 Hint
Common Mistakes
Using -r which is not a valid option here.
Using -c or -m which are unrelated.
3fill in blank
hard

Fix the error in the command to get the SHA-1 hash of file.txt by filling the blank.

Git
git hash-object [1] file.txt
Drag options to blanks, or click blank then click option'
A-r
B-w
C--hash
D--stdin
Attempts:
3 left
💡 Hint
Common Mistakes
Using -r which is invalid here.
Using --stdin which expects input from standard input.
4fill in blank
hard

Fill both blanks to create a SHA-1 hash of README.md and store it in the Git database.

Git
git hash-object [1] [2]
Drag options to blanks, or click blank then click option'
A-w
BREADME.md
C-r
Dfile.txt
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong file names like file.txt.
Using -r instead of -w.
5fill in blank
hard

Fill all three blanks to create a SHA-1 hash of script.sh, write it to the Git database, and then display the hash.

Git
hash=$([1] [2] [3]) && echo $hash
Drag options to blanks, or click blank then click option'
Agit hash-object
B-w
Cscript.sh
D-r
Attempts:
3 left
💡 Hint
Common Mistakes
Using -r instead of -w.
Forgetting to specify the file name.