push to remote repo after local hard reset



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


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.



1 answer

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

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 ?




Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

648 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you