I have two unsynced commits using GitHub (Windows), but don't want to commit them now. How can I revert or drop them?
As mentioned in "How to reach some commands on Github for windows", you best course of action would be to use to git CLI (command line interface), opening a shell from "GitHub for Windows", or using msysgit.
Then a git reset HEAD^2
(or even git reset --hard HEAD^2
if you really want to remove those files as well as any work in progress) would drop those commits (as in "How do I delete unpushed git commits?" or "How to delete a 'git commit'").
After a refresh, GitHub for Windows should display no more unsynced commit.
Other answers below mention the recent addition of "Undo most recent commit
", which achieve the same reset:
As I mentioned in "GitHub undo a discard", the "discard changes" feature would achieve the same as a git reset.
In the newest version of GitHub (Windows) under the Settings button, next to the "Sync" icon/button there is the option "Undo most recent commit", that will take care of those unsynced commits.
Latest version of GitHUb for Windows have this option. The option will be enabled in case you have any unsynced commit. This is a very useful update from GitHub.
There is an undo button. Right click on the file to commit and select "Discard changes".
https://github.com/blog/1441-undo-button-in-github-for-windows
I would suggest, based on the way the questions is phrased, and what searches it comes up for, that people may want to use "FETCH_HEAD when resetting via the git CLI/ ("Open in Git Shell") in the GitHub for Windows menu.
Once in the shell, run: git reset FETCH_HEAD --hard
This will reset you back to where you were when you last pulled down changes from your remote - which is what it seems like some people hitting this page are looking to do.
© 2022 - 2024 — McMap. All rights reserved.