How can I move HEAD back to a previous location? (Detached head) & Undo commits

In Git, I was trying to do a squash commit by merging in another branch and then resetting HEAD to the previous place via: git reset origin/master But I need to step out of this. How can I move HEAD back to the previous location? I have the SHA-1 fragment (23b6772) of the commit that … Read more

How to revert uncommitted changes including files and folders?

Is there a git command to revert all uncommitted changes in a working tree and index and to also remove newly created files and folders? 1 14 You can run these two commands: # Revert changes to modified files. git reset –hard # Remove all untracked files and directories. # ‘-f’ is force, ‘-d’ is … Read more