Question 1
You accidentally committed a secret file config.env. How do you stop tracking it but keep it locally?
Delete the file and re-create it
Add it to .gitignore only
Use git rm --cached config.env and commit
Run git reset HEAD config.env
Question 2
After cloning a bare repository, you see the warning “cloned an empty repository”. What should you do next?
Create a branch in the bare repo
Make a commit locally and push it
Run git pull to fetch code
Initialize git init again
Question 3
What happens if you push directly to a non-bare repository on a shared server?
Git overwrites the files silently
Push is merged automatically
Push is rejected with an error
Repository converts to bare
Question 4
You want to restore the project to a specific past commit using its hash. Which command works?
git reset --merge
git checkout
git revert
git status
Question 5
You made a commit but forgot one file. How can you include it in the same commit?
git commit --fix
git add file && git commit --amend
git update && git commit
git merge HEAD
Question 6
You want to see new commits from the remote without merging them into your branch. Which command should you use?
git pull
git fetch
git merge
git reset
Question 7
In .gitignore, how do you ignore all .log files in logs/ except important.log?
logs/*.log then !logs/important.log
*.log only
logs/** and important.log
logs/ then !*.log
Question 8
What is the purpose of git push -u origin main compared to git push origin main?
Deletes local commits after push
Creates remote branch only
Sets upstream tracking for future commands
Ignores tags during push
Question 9
Which command shows who last modified each line in a file?
git log file.txt
git blame file.txt
git history file.txt
git status file.txt
Question 10
Which Markdown feature allows checklists in a README?
Code blocks using backticks
Blockquotes with >
Task lists using - [ ] and - [x]
Tables with | and -
There are 10 questions to complete.