Well I am the only one using the repository so not sure what is going on ... I had to create a new repository and then move all my files over to new repo in order to continue working on my project. I could not figure out how to merge anything (even though there should have been nothing to merge) and I could not cancel the push and could not revert to an old revision. It was basically stuck and would not push to the repo and would not let me cancel the push or cancel the commit.

Should this not be up to the user to do? Limiting features because they're dangerous is not helpful in any way.

Following a rebase workflow, where you always rebase and never pull/merge, you force push to update your branch when moving it on top of someone else's.Right now, our entire company have to use the command line to do a rediculously simple command.

Hmm. My problem with it is that every time I've seen force push done, it's been a mistake. I've seen other people use tools which have an easy "Force" option that they reach for immediately without understanding the consequences, and they've deeply regretted it later. A GUI is supposed to guide you through potentially unfamiliar territory without leading you into a bear trap - that's why I've resisted having easy access to this. The way I see it is if you really understand these dangerous options, you'll find a way to do it.

A rebase workflow is fine, and should not require a force push - so long as you haven't pushed those commits before. If you have, and you then rebase them on top of someone elses branch, then anyone that pulled or fetched the commits before you rebased them now has dead lines of development.

I guess if you have a situation where no-one ever pulls anyone elses branches (in git) then this might not be such an issue, barring having lots of orphaned commits which will eventually need cleaning up. If anyone did pull, or did base their own commits on top of those which you've now rewritten, then it's a world of hurt.

It's worth noting that the default behaviour of Mercurial 2.2 is to not even allow you to rewrite changes you've pushed (via phases).

Assuming you're talking about git, what sort of setup you have to avoid the nasty consequnces of rewriting? I'm thinking that if I did allow this, I'd require people to explicitly opt-in to have it displayed on the push dialog, perhaps in Preferences with a "Yeah, I really understand what I'm doing" warning message.

I perfectly understand that a GUI should be easy to use, and make it hard to screw things up on, but that doesn't nessecarily mean that features should be cut out. It simply means they should be difficult to access, or come with a couple of warning messages—As you say, just to make sure they really know what they're doing.

You're right with that, but although our company is only 25 people, we can frequently have people out and about, call in sick, lose their laptop, or simply want to share code, and therefore it's best to always push whenever possible. So there's a copy up on the cloud (Also handy for if you screw up your rebase and want to reset back, got a nice little ref sitting there)

You're quite right. It can be a lot of effort to maintain occasionally, but this is mostly down to communication. If you can communicate with anyone who has a local copy of your branch—Which 9/10 you do not need to do, due to it being your feature/dev branch—then you can co-ordinate the merge process, which for them is simply to delete their local ref of your branch. Simple.Yes, clean up is also required once the repo starts to get a little too hefty. A simple archive and prune can do that for you.

It's also worth noting that git DOES allow you to rewrite history, and is one of the main reasons why it's such a powerful (yet potentionally dangerous) DVCS ;)

That sounds brilliant. If people screw things up by force pushing, then that's their fault. All you're doing is giving them the choice to force push if they really, really, really want to. Perhaps not only have a warning on setting the option to display the feature, but also a disable-able warning when selecting the force option in the push dialog, and not remember the force option of course.That should make it sufficently difficult for anyone to accidentally force push, and only give the option to people that know what they're doing.

OK, that's pretty much what I thought - it does require people to know what they're doing, and does require an occasional 'cooridination dance'. If people fully understand that, it's no problem. The problem with GUIs is that they can give people a false sense of security when exposing things like this!

I still think that to support it, I'd like to make this an enableable option in preferences first rather than just always having the Force checkbox on the Push dialog with a warning behind that. The reason? People often push in a rush (maybe as they try to get out the door at the end of the day!), and this is a perfect time for rushed decisions and 'warning blindness'. I think if they got an error about creating new HEADs on the remote and the force button was right there, even with a warning they could quite happily click straight through just to get out of there even if they have absolutely no idea what it does. I think checking a box in Preferences to say "I want to see that option because I understand it" adds a little extra firewall that will make it more likely that it's only used by people that are fully aware of the consequences.

You got it. But it's the workflow we've gone for, and there's quite a number of others that use this too ()

Maybe I didn't word this part right:

Perhaps not only have a warning on setting the option to display the feature, but also a disable-able warning when selecting the force option in the push dialog, and not remember the force option of course.

I meant that perhaps there should be both a setting under preferences to enable the option (as you suggested), have a disable-able ("Don't display this warning again" checkbox) warning when selecting the force option when pushing, and have it never remember the force option, so the user has to click "force" every time they want to force.Your suggestion makes so only people who know what they're doing use it.My first suggestion makes so people who THINK they know what they're doing, reconsider it.My second suggestion makes so you can't blindly force push as easily.

Ultimately, it's your application. Just putting forward ideas here to help out the problem that you wish you avoid :)

+1 for adding the ability to toggle --force onto a push command in Source Treeforce. Its not the tools responsibility to prevent a user from doing something stupid, IMHO. I'm an experienced Git user and rebasing a branch that I've pushed up (usually for code review purposes) is a best practice in my book.

Ugh, I hate it when apps decide to limit what I can do in the name of the dummies who will get themselves into a bind. Make it find to hard this option if you want, even make it flash big red text warning them what they are doing, but don't just leave it out...

This annoys me the same way Fogbugz annoyed me when they just arbitrarily decided that NOTHING can be deleted, only archived. So now we have about 25 to 30 test tickets that can't be deleted, from me trying to interface with the Fogbugz API from our application and creating test tickets.

Give your advanced users some credit. I just spent time restructuring my commits, changing things around. I reset back one commit because I didn't want it in the history. Now I go to push and of course I need to force push because the remote still has the commit I'm deliberately trying to remove. I know that I will not step on anyone's toes; I know what I'm doing. Yet now I have to drop down to the command line just to run one stupid command.

Why is it so bad to include an advanced menu with some kind of warning, but give me the option to actually do the things that git can do?? Whenever you force me to drop to the terminal I start to feel like I should just stay there. What's the point of a GUI if I still have to use the command line? I really like the GUI when it does what I expect it to; it's just when it doesn't that it falls short and puts a bad taste in my mouth.

You got it. But it's the workflow we've gone for, and there's quite a number of others that use this too ()

Maybe I didn't word this part right:

Perhaps not only have a warning on setting the option to display the feature, but also a disable-able warning when selecting the force option in the push dialog, and not remember the force option of course.

I meant that perhaps there should be both a setting under preferences to enable the option (as you suggested), have a disable-able ("Don't display this warning again" checkbox) warning when selecting the force option when pushing, and have it never remember the force option, so the user has to click "force" every time they want to force.Your suggestion makes so only people who know what they're doing use it.My first suggestion makes so people who THINK they know what they're doing, reconsider it.My second suggestion makes so you can't blindly force push as easily.

Ultimately, it's your application. Just putting forward ideas here to help out the problem that you wish you avoid :)

Problem with this, as described in the comments above, is that if it's too easy for the user to do, they can screw up their entire repo—while the feature should be there, agreed—and then blame the GUI for throwing their repo into chaos. It's best that that situation is prevented as much as possible, while still being easy to use for those that need to, and know what they're doing.

By default the forced push is not possible, you first need to enable it in the preferences. Otherwise SmartGit will abort the push. I need forced push nearly every second day for rebased branches which only I control.

Or is there maybe a better way to accomplish what we are doing with force push?

We use gitflow, and before merging a working branch (feature/bugfix/hotfix) to develop or master, we do a squash rebase from the parent branch (master or develop). We squash the working branch in order not to clutter the parent branch with a lot of intermediate commits. Then we need to force push the working branch to origin, rewriting history of the working branch. Finally, the working branch is merged to the parent branch, creating a single commit for the added feature on the master branch. (Or sometimes a few commits if applicable and desired during the squash.) Working branch is then deleted.

(If we do not squash commits, it is very hard to encourage everyone to do many intermediate commits, and many commits is of cause valuable if something goes wrong, HW failure or whatever.)

I'd like to add my two cents. I also agree with many others about limiting features. I don't mind obfuscating some more dangerous features in some kind of an "advanced" menu or something, as long as I can get to it. This is the absolute number one reason why I HATE the official Github mac/windows client. It hides A TON of stuff, including push & pull (which is really irritating). Whenever I am forced to drop to the command line it lessens my opinion of the tool.

I know what I'm doing when I force push and I really like sourceTree. Please add the ability to do force push. I don't care if it's in blinking red text that says the world will explode if you use it, just add it please. I don't think it's atlassian's job to make sure I don't make a silly mistake; I think a clear warning message would be just fine.

I do want to give props though for creating the aboslute best cross-platform git GUI I've yet to use. I'm so glad there is a "fetch" button at the top instead of just "pull". You guys have done a stellar job of putting all of git's complicated options into a nice interface that's easy to look at. Now if we could just add in some of these things that you deliberately left out I would be a very happy customer. I'd even be a paying customer for this product if there was such an option. It's that good.

Edit: I didn't notice that this was added, my bad. I am very grateful :)