问题
So I make my file changes, but when I try to push them source tree complains that some one else pushed before me.The files are different,yet I am forced to merge the changes. Some times I have to backup and reset my workspace before it can allow me to push again Is there no way to force the push?
回答1:
- Open SourceTree
Preferences
- Tab:
Advanced
- Third checkbox:
Allow force push
- Enable the checkbox and close Preferences.
Next time you push, there will be an extra checkbox: Force push
.
Checking it will also display an additional Confirm Force Push
dialog box before the force push is actually performed.
回答2:
Even though the files are different, you have to perform a merge or a rebase before you can push. The commits from your current working branch have to be merged into the current branch that exists on the server before you can update it. You're merging the branches, not the files.
Using the "force push" command does not force your commits to be applied in addition to what is on the remote branch - it forces your commits to replace the commits on the remote branch. Using this option would throw away all of the commits that had been made by the other user.
Because this is a destructive operation, SourceTree does not include GUI access to the "force push" command. Here's what Steve Streeting from Atlassian says about it:
SourceTree doesn't expose force push because it's almost always not what you want to do.
It means that someone else has pushed before you. What you should be doing is pulling their changes, merging them (or rebasing your changes on top of them), and then pushing.
来源:https://stackoverflow.com/questions/36935099/source-tree-not-able-to-push