What is the effect of git reset --hard HEAD^?
- Moves HEAD to the previous commit
- Discards changes in the working directory
- Unstages changes from the index
- Creates a new branch
The command git reset --hard HEAD^ resets the current branch to the previous commit, discarding all changes in the working directory and staging area. It's a forceful reset, so use it with caution as it cannot be undone.
Loading...
Related Quiz
- For an open source project on GitHub, what is the standard method for contributing changes?
- How does git stash pop differ from git stash apply?
- What is the main benefit of conducting code reviews before merging changes?
- After making several commits, a developer realizes they need to combine these commits into a single commit. What Git process should they follow?
- How can you create an annotated tag in Git that includes a message?