Reputation: 7820
I started using SourceTree a few days ago to manage Mercurial repositories with my Mac. Now I ran into the problem when pushing to my remote repository creates a new head on a new branch and I would like to force it.
However, I am not able to find any specific option in SourceTree which allows me to set the force option for a push. Is it just my inability to find it or is there no possibility to set it?
Thanks in advance Michael
Upvotes: 54
Views: 41574
Reputation: 4941
You can show it on Settings -> Advanced -> Allow force push
Then force push option would be available.
Upvotes: 21
Reputation: 4168
it's now under Sourcetree -> Preferences -> Advanced -> Allow force push
Upvotes: 0
Reputation: 649
In SourceTree version 2.5.5.0 there is an option for that.
Make sure you have enabled in options:
[Menu] Tools -> Options -> [Tab] Git -> [Section] Enable Force Push
After that, you can force push it using push button in toolbar:
And it works!
Upvotes: 7
Reputation: 7102
SourceTree is finally going to add force push: https://jira.atlassian.com/browse/SRCTREE-1156
Reason: https://answers.atlassian.com/questions/54469/how-do-i-perform-a-forced-push-push-f-from-sourcetree
Edit: It is now added in SourceTree, but you need to turn the option on in the settings.
Upvotes: 24
Reputation: 5436
SourceTree (as of ver. 1.4.2) issues a hg push --new-branch
as needed, so if you create a new branch (as opposed to having two heads on one branch), you just do a regular push (Repository → Push). You can, optionally, specify a branch you want to push if you have outgoing changesets on several branches.
I wasn't able to find a way to do a hg push --force
proper via the SourceTree dialogs. I agree with @Ry4an that this option is more dangerous than useful. I've never done a force push since --new-branch
was introduced, and never needed it to combine unrelated repositories or push a two-headed branch (a force pull is much safer).
I conclude that on a rare occasion when a force push is needed, opening Terminal won't hurt. If you disagree, please share your workflow in comments.
Upvotes: 2