Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove unsynced commits in github for windows?

Tags:

I have two unsynced commits using GitHub (Windows), but don't want to commit them now. How can I revert or drop them?

screenshot

like image 547
gezhonglunta Avatar asked Feb 20 '13 02:02

gezhonglunta


People also ask

Can you remove commits from GitHub?

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

How do I get rid of extra commits?

You can simply remove that commit using option "d" or Removing a line that has your commit. In the latest git version there is no more option d. You need just remove lines with commits from rebase to delete them.


2 Answers

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:

Undo most recent commit


As I mentioned in "GitHub undo a discard", the "discard changes" feature would achieve the same as a git reset.

like image 170
VonC Avatar answered Oct 15 '22 07:10

VonC


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.

like image 20
drverboten Avatar answered Oct 15 '22 08:10

drverboten