Which command is used to undo a commit that has not been pushed to the remote repository?
- git reset --soft HEAD^
- git revert HEAD
- git reset --hard HEAD^
- git reset HEAD^
The correct option, git reset --hard HEAD^, is used to undo the last commit completely. It discards changes and moves the HEAD pointer to the previous commit. git reset --soft HEAD^ preserves changes, git revert HEAD creates a new commit to undo changes, and git reset HEAD^ is for unstaging.
Loading...
Related Quiz
- In a situation where multiple teams are working on different features simultaneously, how should merge conflicts be addressed to maintain a stable main branch?
- In a case study of a successful enterprise, what Git practice was found to be key in managing their large-scale projects efficiently?
- A ________ is a pointer to a specific commit in Git.
- The strategy of _______ involves integrating changes from the main branch frequently to minimize conflicts.
- What is the purpose of a 'release' branch in advanced branching strategies?