git推送不能完全退出错误

背景:

我推送一个工程上去:

提示推送失败,git不能完全退出,贴上错误代码:
git push origin master

To ../remote/

 ![rejected]        master -> master(non-fast forward)

error: failed to push some refs to'../remote/'

To prevent you from losing history,non-fast-forward updates were rejected

Merge the remote changes before pushingagain.  See the 'non-fast forward'

section of 'git push --help' for details.

 

 

Google一下:

Thiserror can be a bit overwhelming at first, do not fear.
Simply put, git cannot make the change on the remote without losing commits, soit refuses the push. Usually this is caused by another user pushing to the samebranch.
You can remedy this by fetching and merging the remote branch, or using pull toperform both at once.

In other cases this error is a result of destructive changes madelocally by using commands like git commit --amend or git rebase.
While you can override the remote by adding --force tothe push command, you should only do so if you are absolutely certain this iswhat you want to do. Force-pushes can cause issues for other users that havefetched the remote branch, and is considered bad practice. When in doubt, don’tforce-push.

 

 

解决方案:
1.拉取内容

2.合并

 

问题成功解决

你可能感兴趣的:(Tools)