push to remote repo after local hard reset

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

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 ?

 

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

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

413 views 0 1
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