Tag Archives: Git operation

[Solved] Git submits locally to the remote warehouse Error: failed to push some refs to…

Today, a new project was created locally and a warehouse was built on the code cloud. You want to push it to the code cloud locally, but git push - U origin master , an error is reported:

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/xxx/app.git'
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.

After searching, use: git pull -- rebase origin master to solve the difference between
rebase and merge:

rebase puts the commit from your current branch at the end of the public branch, so it's called a rebase.
merge merges the public branch with your current commit to form a new commit