Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the command to initialize a new Git repository.
Git
git [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git commit' before initializing a repository
Trying to 'git push' without a remote repository
Confusing 'git clone' with repository creation
✗ Incorrect
The git init command creates a new Git repository, setting up the necessary structure to store objects.
2fill in blank
mediumComplete the command to add a file to the Git staging area.
Git
git [1] filename.txt Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'git commit' without staging files
Trying 'git push' before committing
Confusing 'git status' with adding files
✗ Incorrect
The git add command stages changes, preparing files to be saved as objects in Git.
3fill in blank
hardFix the error in the command to create a commit with a message.
Git
git commit -m [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the commit message
Using mismatched or incomplete quotes
Using underscores instead of spaces without quotes
✗ Incorrect
The commit message must be enclosed in quotes to be recognized as a single string.
4fill in blank
hardFill both blanks to create a Git object hash from a file.
Git
git hash-object -[1] [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
-r which only reads the hash without storingUsing 'commit' instead of a filename
Omitting the filename
✗ Incorrect
The -w option writes the object to the Git database, and file.txt is the file to hash.
5fill in blank
hardFill all three blanks to create a tree object from a directory.
Git
git mktree < [1] | git hash-object -[2] --stdin -t [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'commit' instead of 'tree' for object type
Omitting the write option
-wNot providing the correct input file
✗ Incorrect
tree.txt contains the tree data, -w writes the object, and tree specifies the object type.