1

I have a local repository under Sourcetree for Mac, which is tracking the master branch of a remote repository. I tried importing a branch that is in the remote repo but not in my local one, so I picked it under the "Remotes" label and pressed "Pull"… but it looks like it pulled and merged the changes in that branch into my local master. Now I have in my master a message that says "6 ahead", and a badge in my "Push" button asking me to push those 6 changes into the remote master.

I don't want to do that; I want to discard those 6 changes and leave my local master as it was. After searching, the suggested solution seems to be to pick the commit in question and right-click to "Reset master to this commit", but it didn't do the trick; the pending commits still appear in the "Push" button. What can I do?

(I don't have git installed on this machine, only Sourcetree, so a Sourcetree-only solution would be preferred).

PaulJ
  • 1,646
  • 5
  • 33
  • 52
  • I'm not certain, but i'm pretty sure you have git installed on your machine, since sourcetree uses git. – Tony Barnes Mar 27 '15 at 12:02
  • If I open a Terminal and type `git`, it says "Command not found". – PaulJ Mar 27 '15 at 12:10
  • OK, it seems you need to install git: http://git-scm.com/download/mac – Tony Barnes Mar 27 '15 at 12:12
  • So I take it that there's no way of doing this inside Sourcetree? – PaulJ Mar 27 '15 at 12:16
  • There probably is, but i'm not sure off hand. If you install git, it will only take a couple of mins to do it via the command line :) – Tony Barnes Mar 27 '15 at 12:17
  • Was my answer any use to you? – Tony Barnes Mar 27 '15 at 16:37
  • Sorry, but not really. I had already found several answers explaining how to solve this using git, but since I didn't have it installed, I wanted to see if there was a way to solve it with Sourcetree, which is what I have at hand. Thanks for the effort, though. – PaulJ Mar 27 '15 at 16:42
  • You're welcome. You should really try out git via the command line - it's super easy to install, and once you know a couple of the basic commands the rest is easy to learn. You'll better understand what's going on than by using a GUI, and you can do so much more. I used to use sourcetree myself, then moved to the command line - i've never looked back :-) – Tony Barnes Mar 27 '15 at 16:48
  • 2
    It's **2016** and this **still cant be done** inside SourceTree. Instead use `git --reset hard xxx` as per [this answer](http://stackoverflow.com/a/24877113/585968) –  Mar 03 '16 at 01:04

0 Answers0