0

I am new to Bitbucket/Sourcetree. After clone the repository to my local machine. I made one one comment to test it. Say it was:

just add commit

Then I clicked commit button. After that I didn't want to push it as it just was an practice. I prehaps clicked Discard(not recall clearly). Now it shows Revert "just test commit"

My question is that I really don't want to push it, how to get rid of it as the "Push" button shows "2" on it. See the image.

I tried the command git stash but it was not working.

commit

Hui Zhao
  • 655
  • 1
  • 10
  • 20

1 Answers1

0

It is tracking history. So if you pushed the 2 "changes", it would just show that you made a change, and then reverted it back.

There is an option in Git called "stash" which basically puts aside the local changes. You can do that, then just delete the stash. In SourceTree you can find the stash option under the "Repository" menu (at least on OSX).

If all you want to do is "reset" your local repo/branch to match the remote, this thread is a really good discussion about how to do that: Various ways to remove local Git changes

Community
  • 1
  • 1
Joel Kinzel
  • 969
  • 2
  • 7
  • 19
  • I saw the stash option under the "Repository", do I need to click "keep staged changes"? – Hui Zhao Jan 12 '15 at 21:11
  • I personally can't think of a time I would keep the staged changes. The point of stashing it to "undo" your current changes, but keep them off to the side. If all you want to do is reset your local repo to match the remote this thread is a really good discussion on that: http://stackoverflow.com/questions/22620393/remove-local-git-changes – Joel Kinzel Jan 12 '15 at 21:35
  • I did it, but not sure why the number "2" is still showing on `Push`? – Hui Zhao Jan 12 '15 at 21:59