CS FundamentalsHardProduct-company placement · Git interview
feature has commits X, then Y, then Z (oldest to newest). On main you run git cherry-pick X..Z. Which commits are applied?
- A. X, Y and Z
- B. Only X and Z
- C. Only Z
- D. Only Y and Z
Correct answer: D. Only Y and Z
A..B ranges exclude the starting commit, so X..Z means Y and Z. To include X you would write X^..Z.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- Your working tree has a modified tracked file f.txt and a new, never-added file u.txt. You run git stash. What does git status show next?
- A .gitignore contains the two lines logs/ and !logs/keep.log. A developer expects logs/keep.log to be tracked, but git status never shows…
- A team lead adds a pre-commit hook to .git/hooks/pre-commit in her repository and pushes. Teammates who clone the repository report that…
- After rebasing your branch you must update the remote branch. A colleague may have pushed to the same branch meanwhile. Why prefer git…
- You create an annotated tag v2.0 locally and run git push. The tag does not appear on the remote. What is correct?
- A file config.env holding a live API key was committed and pushed three weeks ago. The developer now runs git rm --cached config.env, adds…