Source tree not able to push

三世轮回 提交于 2019-12-24 01:12:55

问题


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:


  1. Open SourceTree Preferences
  2. Tab: Advanced
  3. Third checkbox: Allow force push
  4. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!