我们正在使用 git 进行版本控制,现在我们在尝试上传最新版本时收到很多警告。我是 git 新手,对这些限制没有耐心,有没有办法删除所有内容并上传当前版本?
这是我在尝试上传时得到的结果。
$ git push origin master
Username for 'https://code.google.com':
Password for 'https://<removed>@code.google.com':
To https://code.google.com/p/<removed>/
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://code.google.com/p/<removed>/'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
最佳答案
1.) 删除存储库文件夹中的所有内容
2.) 运行 git rm *
告诉 git 删除所有文件(检查 git status
是否还有未暂存的文件)
3.) 执行 git commit -a -m "commitmessage"
a git push origin master
删除远程 git 服务器上的所有文件
4.) 检查你现在是否有一个空的远程仓库
5.) 将所有新文件复制到本地存储库文件夹
6.) 运行 git add *
告诉 git 添加所有新文件(检查 git status
是否还有未暂存的文件)
7.) 提交并推送新文件
现在您的远程 git 存储库中应该有该版本。
关于git - 删除所有内容并上传新版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11071420/