How can I push with sourceTree?

ⅰ亾dé卋堺 提交于 2019-12-23 02:54:31

问题


I am managing project of Unity (ver 4.6.3) with sourceTree I just wanted to return to the previous commit, right click to select "Reset current branch to this commit", select "Hard" in the using mode, and put it back to the previous commit. After that, I tried to push, but I failed to push. Sorry, I forgot to take the error at that time.

After that, I thought that I could not push as it was, so I created another remote repository, moved my Unity project there and committed it. Although I was able to commit, I could not push it. The error at that time is here

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags    
origin master:master
fatal: HttpRequestException encountered.
   ????v??????M????G???[??????????????B

Pushing to "my remote repository"
To "my remote remote repository"
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'my remote repository'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Is there a file that needs to be deleted? If you know answer, please let me know.


回答1:


If you do a reset --hard, you will need to force the push in order to complete your operation.

It is supported by SourceTree since 2016:

You'll first need to enable force-push in the options menu, and from there you will be able to choose between using "safe" and "unsafe" force-push.
Each time you use force-push from the push dialog you'll need to check the checkbox, and confirm the dialog prompt.

Make sure you have warned your colleague, if you are not alone working on that repository.
(considering git push --force-with-lease is not yet supported by SourceTree)



来源:https://stackoverflow.com/questions/51868110/how-can-i-push-with-sourcetree

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