Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove waiting push in SourceTree

I committed files that I don't want to push. I didn't push yet.

How can I remove the commit?

This is how my screen looks:

change list

These are the options:

options

I don't want to undo any changes to the source code!

like image 497
clankill3r Avatar asked May 24 '15 12:05

clankill3r


People also ask

How do I get rid of waiting push in SourceTree?

Select "Reset current branch to this commit." In the resulting dialog, select "Mixed..." from the drop down and click OK. Your working copy will remain the same (no files will be changed) but the index will be reset, meaning that all commits after the selected one will be removed from your history.

How do I get rid of pending push?

There are two ways to accomplish this. Move the remote branch ( git push ) or move the local branch ( git reset ).

How do you undo commit before push SourceTree?

In the new window, select the commit you want gone, and press the "Delete"-button at the bottom, or right click the commit and click "Delete commit". Click "OK" (or "Cancel" if you want to abort).

How do I remove uncommitted changes in SourceTree?

On SourceTree for Windows, right click the files you want to discard (in the Working Copy Changes list), and choose Discard. On git, you'd simply do: git reset --hard to discard changes made to versioned files; git clean -xdf to erase new (untracked) files, including ignored ones (the x option).


1 Answers

To remove the commit without changing any source code, you need to perform a "mixed" reset.

Right click on the last "good" commit (this will probably be origin/master). Select "Reset current branch to this commit."

Reset current branch to this commit

In the resulting dialog, select "Mixed..." from the drop down and click OK.

Mixed

Your working copy will remain the same (no files will be changed) but the index will be reset, meaning that all commits after the selected one will be removed from your history.

like image 107
BJ Myers Avatar answered Sep 29 '22 16:09

BJ Myers