CS FundamentalsHardWipro · Accenture pattern
How many of the following statements about git reset are correct? 1. git reset --mixed HEAD~1 removes the last commit and leaves its changes unstaged in the working directory. 2. git reset --hard HEAD discards both staged and unstaged changes to tracked files. 3. git reset --hard also deletes untracked files. 4. A commit lost through git reset --hard can usually be recovered with git reflog.
- A. Only one
- B. Only two
- C. Only three
- D. All four
Correct answer: C. Only three
1, 2 and 4 are correct. 3 is wrong: reset --hard leaves untracked files alone; git clean -fd removes them. Commits stay reachable through the reflog until it expires, so they can be restored. So three are correct.
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
- On main you run git merge --squash feature and then git commit. Afterwards you try git branch -d feature. What happens?
- You checked out an old commit by its hash, made two commits, then ran git checkout main. What happened to those two commits?
- A file secrets.env was committed last month. Today you add secrets.env to .gitignore and commit. Why does git status still show changes to…
- Two developers branch from the same commit. In which of these situations will git merge report a conflict? 1. Both changed different…
- Match each SOLID principle with the violation it forbids. P. Single Responsibility Q. Interface Segregation R. Open/Closed S. Dependency…
- Match each pattern with its intent. P. Builder Q. Facade R. Proxy S. Strategy 1. Give a simple single entry point to a complex subsystem…