Git reset

Get list of commits to choose from

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
git log
git log
git log

 

Git reset can change the branch pointer to point to any commit in the tree.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
git reset --hard <hash>
git reset --hard <hash>
git reset --hard <hash>
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ git reset --hard 07a2a46
$ git reset --hard 07a2a46
$ git reset --hard 07a2a46

HEAD is now at 07a2a46 Updated index.html

If you quickly check the log, you will see no history of the commits after 07a2a46

Update branch on remote 

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
git push
or
git push origin HEAD --force
git push or git push origin HEAD --force
git push

or 

git push origin HEAD --force

 

 



Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

Your email address will not be published. Required fields are marked *