【发布时间】:2021-09-01 07:36:13
【问题描述】:
首先我提交了 master 分支,现在我在 main 分支中,无法更改为 master 分支。此外,如果我尝试通过主分支提交我的仓库,则会显示以下错误:-
$ git push --set-upstream https://github.com/manvith22/Evernote-clone.git main
To https://github.com/manvith22/Evernote-clone.git
! [rejected] main -> main (fetch first)
error: failed to push some refs to 'https://github.com/manvith22/Evernote-clone.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.
abc@MA MINGW64 ~/react-redux-hooks (main)
$ git pull <remote> master:dev
bash: remote: No such file or directory
abc@MA MINGW64 ~/react-redux-hooks (main)
$ git pull <main> master:dev
bash: main: No such file or directory
abc@MA MINGW64 ~/react-redux-hooks (main)
$ git pull <evernote> master:dev
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=<remote>/<branch> main
【问题讨论】:
-
是
main,不是master。 -
另外,一个重要的术语点:您在本地存储库中提交更改。当您推送您已经提交的工作时显示的命令 - 即与远程服务器共享>或同步它.当您学习如何使用 git 时,了解其中的区别将非常重要。