Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

push to remote repo after local hard reset

nofishonfriday September 15, 2016

Hi,

 

when I do a local hard reset to some previous commit and try to push to remote repo I get a "remote repo is ahead" (along those lines) error message.

 

Found this related thread at stackoverflow

click

What I currently do from command line is what's mentioned there as answer:

 

git fetch origin
git reset --hard origin/master
git clean -f

 

Can I also do this directly from within SourceTree ?

I see a button for fetching, is functionality for reset and clean also build in ?

 

Just curious, as this would make the process a little quicker than switching to command line.

 

Thanks.

1 answer

1 vote
Tim Crall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 15, 2016

That's an odd series of commands.  You should be able to just do a 

push -f

I don't think you can do it within SourceTree, though - at least, not without setting up a Custom Action, which I haven't played with much

nofishonfriday September 15, 2016

Thanks, I'll try next time I need to do this and report back.

Talking of force-push, there actually is a "Force" tickbox in SourceTree's Push dialog, but it's always grayed out here. Any idea why ?

 

http://i.imgur.com/0JO4sTp.jpg

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events