git说一切都是最新的 [英] git says Everything up-to-date
问题描述
- 我在做一个项目并做了一个提交,远程github存储库。
- 但后来我意识到我犯了一些错误,所以我做了$ git --amend -am我的信息
- 现在,由于出现错误,我无法再次推送到远程服务器。所以,我想删除远程github回购&
- 现在,当我尝试推送时,它会显示所有内容都是最新的。
请指导我如何解决这个问题?
听起来像两件事在这里出了问题。
首先,您修改了一个已经成为远程存储库历史记录一部分的提交,这是一个不容否认的问题。与其重新回答这个抱怨,我会指导你回答:如何将修改的提交推送到远程Git存储库?
接下来,即使您重新创建了远程存储库,您的本地存储库仍然具有旧的本地历史记录。你要做的是运行 git remote rm origin
,然后 git gc
,然后 git remote add origin< path_to_repo>
,然后最后 git fetch origin
。这应该选择新的远程存储库,并允许您将更改推送给它。 First of all, I am a noob at using git.
- I was working on a project and did a commit and pushed to remote github repository.
- But, then later I realized that I did some mistake, so I did $git --amend -am "My message"
- Now, I was not able to push again to the remote server as I was getting error. So, I thought of deleting the remote github repo & recreated the same with the same name.
- Now, when I try to push, it says "Everything up-to-date".
Please guide as to how do I solve this?
Sounds like two things have gone wrong, here.
First up, you amended a commit that had become part of the remote repository's history, which is a bit of a no-no. Rather than re-answer this gripe, I'll direct you to the answer: How do I push amended commit to the remote Git repository?
Next, chances are that even though you re-created the remote repository, your local repository still has the local history from the old one. what you'll want to do is run git remote rm origin
, then git gc
, then git remote add origin <path_to_repo>
, then finally git fetch origin
. This should pick up the new remote repository, and allow you to push your changes to it.
这篇关于git说一切都是最新的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!