如何解决仅一个文件的推送被拒绝,以取代github上的远程对应项?
试试这个https://happygitwithr.com/push-rejected.html没有任何成功
。消息
! [rejected] main -> main (fetch first)
error: failed to push some refs to 'https://github.com/abdulbadii/MatrixMultiplier'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details
看起来像是其他人在同一个git分支上工作,所以只要把你的修改藏起来git stash
,然后运行git pull origin branch_name
然后运行git stash pop
查看更改之后push你的代码