删除所有内容并上传新版本 [英] Delete everything and upload new version

查看:106
本文介绍了删除所有内容并上传新版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用git进行版本控制,现在我们在尝试上传最新版本时收到很多警告。我是git的新手,并没有耐心的限制,有没有什么办法可以删除所有内容并上传当前版本?



这就是我现在得到的东西尝试上传。

  $ git push origin master 
'https://code.google.com'的用户名:
'https://<已删除> @ code.google.com'的密码:
至https://code.google.com/p/<removed>/
! [被拒绝] master - >主(非快进)
错误:无法将某些参考推送到'https://code.google.com/p/<removed>/'
提示:更新被拒绝,因为当前分支的提示位于
提示后面:其远程对象。合并远程更改(例如'git pull')
提示:再次按下之前。
提示:有关详细信息,请参阅'git push --help'中的'关于快速转发的注意事项'。


解决方案

p>

2。)运行 git rm * 告诉git删除所有文件(检查 git状态是否还有未分离的文件)



3)做一个 git commit -a -mcommitmessage a git push origin master 删除远程git服务器上的所有文件



4.)检查你现在是否有一个空的远程仓库。



5。)将所有新文件复制到本地存储库文件夹中。

<6>)运行 git add * 告诉git添加所有新文件(检查 git status 是否还有未分离的文件)



7。)提交并推送新文件



现在你应该在你的远程git仓库上有版本。


We are using git for version control and right now we are getting a lot of warnings when trying to upload the most recent version. I am new to git and don't have patience for the restrictions, is there any way to delete everything and upload the current version?

This is what I get now when trying to upload.

$ 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.) Delete everything in your repository folder

2.) run git rm * to tell git to remove all files (check with git status whether there are any unstaged files left)

3.) do a git commit -a -m "commitmessage" a git push origin master to delete all files on the remote git server

4.) check if you have an empty remote repository now

5.) copy all new files to the local repository folder

6.) run git add * to tell git to add all new files (check with git status whether there are any unstaged files left)

7.) commit and push the new files

Now you should have the version on your remote git repository.

这篇关于删除所有内容并上传新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆