git commit --amend 解决git push rejected

当出现如下错误时:

  my_project_name git:(master) git push

Counting objects: 3, done.

Delta compression using up to 8 threads.

Compressing objects: 100% (3/3), done.

Writing objects: 100% (3/3), 357 bytes | 178.00 KiB/s, done.

Total 3 (delta 2), reused 0 (delta 0)

remote: -----------------------------------------------------

remote: REJECTED: 本次提交被拒绝

remote: wuyong已经在master上面提交了代码,该代码还没有上线或正在上线中

remote: 请联系wuyong确认是否可以进行本次提交,如可以提交,则请在comments中增加关键字--forcemaster重新提交

remote: -----------------------------------------------------

remote: 

To ssh://git.***.com/bm/my_project_name.git

 ! [remote rejected]     master -> master (pre-receive hook declined)

error: failed to push some refs to 'ssh://git@git.***.com/bm/my_project_name.git'

 

解决步骤:

 

git commit --amend -m "merge branch ‘mtmq_upgrade_fhw_180703’ --forcemaste

 

git push

猜你喜欢

转载自www.cnblogs.com/fhwup/p/9358653.html