git推送显示所有最新信息

git推送显示所有最新信息,git,push,commit,patch,Git,Push,Commit,Patch,git这里的新手,用于subversion: 我已经承诺了一些本地更改,现在想推动这些更改,但我得到了: $ git push Everything up-to-date 在谷歌快速搜索之后,我发现:我觉得很棒并开始遵循公认答案中的建议: $ git log -1 #got the hash key $ git checkout master M util/logging/cp_logging.cpp Already on 'master' Your branch is up-to

git
这里的新手,用于
subversion
: 我已经承诺了一些本地更改,现在想推动这些更改,但我得到了:

$ git push
Everything up-to-date
在谷歌快速搜索之后,我发现:我觉得很棒并开始遵循公认答案中的建议:

$ git log -1
#got the hash key
$ git checkout master
M       util/logging/cp_logging.cpp
Already on 'master'
Your branch is up-to-date with 'origin/master'.
#Now I got nervous and verified with git status 
#and git diff that my changes were still there
#just for safety I did a
$ git diff >save.patch
#followed by(as recommended):
$ git reset --hard 579823db25d2a821c2940608e9cb8122c2779b37
HEAD is now at 579823d Merge remote-tracking branch 'upstream/master'
#then I did a 
$ git status
# and realized that my changes were gone!

如何将我的更改(幸运地保存了save.patch)恢复到本地工作副本中,然后从这里将更改推送到在线回购?我的更改是否应该在我的本地回购协议中已经提交(就像我之前做的
git提交那样)?

这是我的答案,9年前,并且只有当您的git状态显示您不在任何分支机构(分离的头部)时才是如此

无论如何,您可以使用重新应用保存的修补程序


然后添加、提交和推送。

git apply save.patch
。然后,
git reset--hard
是git与核武器的等价物,因此在工作树周围进行更改时要小心使用。如果它是你正在玩的承诺的东西,你可以做各种各样的把戏,让它从硬重置中恢复过来,但对于那些没有承诺的东西,情况就不一样了。