简体   繁体   中英

How can I push with sourceTree?

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.

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 )

There is following option in my Source Tree v. 3.1.2 :

ToolsOptionsGitEnable Force PushUse Safe Force Push (--force-with-lease)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM