Question 2Easy
How do you list all stashes?
- git stash show-all
- git stashes
- git log --stash
- git stash list
Answer: D. git stash list
Explanation
git stash list shows stash@{0}, stash@{1}, newest first.
Step-by-step solution
- Stashes form a stack.
- List shows them newest first.
- Apply a specific one via
stash@{n}.
Why the other options are wrong
- A. No such option.
- B. No such command.
- C. Not an option.
Question 3Easy
Which command creates an annotated tag v1.0 with a message?
- git tag -a v1.0 -m "Release 1.0"
- git tag v1.0 -commit
- git branch -t v1.0
- git label v1.0
Answer: A. git tag -a v1.0 -m "Release 1.0"
Explanation
Annotated tags are full objects with author, date and message. A lightweight tag is just a ref.
Step-by-step solution
-a makes it annotated.-m sets the message.- Push with
git push origin v1.0.
Why the other options are wrong
- B. Invalid option.
- C. Branches are not tags.
- D. No such command.
Question 5Medium
Difference between git stash pop and git stash apply?
pop keeps the entry in the list and apply removes it afterwards- They are identical
pop applies and drops the stash entry; apply keeps itpop pushes to remote
Answer: C. pop applies and drops the stash entry; apply keeps it
Explanation
Apply is useful to reuse the same stash on several branches.
Step-by-step solution
- Both re-apply the changes.
pop removes the entry.apply keeps it in the list.
Why the other options are wrong
- A. It is the other way around.
- B. Pop removes the entry.
- D. Stash is local.
Question 6Medium
What does git describe typically output for a commit 3 commits after the annotated tag v2.0?
- Only the word v2.0, whatever the number of later commits is
- The tag message
- The parent hash
- A name like v2.0-3-gabc1234 (tag, commits since, short hash)
Answer: D. A name like v2.0-3-gabc1234 (tag, commits since, short hash)
Explanation
It describes a commit relative to the nearest reachable tag, handy for version strings.
Step-by-step solution
- Find nearest tag.
- Count commits since it.
- Append
g plus the short hash.
Why the other options are wrong
- A. Plain tag only on the tagged commit.
- B. Messages are shown by
git show. - C. Not a parent hash.