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
- What are the best practices for managing a pull request in a large project?
- In complex projects, integrating Git with IDEs enables _________ tracking for each branch.
- Which Git command is used to undo the last commit while keeping the changes in the working directory?
- In a complex project workflow, a __________ Git hook can enforce commit message standards.
- During the migration to Git, a team encounters issues with large binary files slowing down the repository. What Git feature or strategy can address this issue?