git push说的一切都是最新的,但它肯定不是
我有一个公共存储库。没有其他人用叉子叉过、拉过或对它做过任何其他事情。我对一个文件做了一些小的更改,成功地提交了它们,并尝试推送它们。上面写着“一切都是最新的”。没有分支。我对git非常非常陌生,我不明白到底发生了什么git push说的一切都是最新的,但它肯定不是,git,push,Git,Push,我有一个公共存储库。没有其他人用叉子叉过、拉过或对它做过任何其他事情。我对一个文件做了一些小的更改,成功地提交了它们,并尝试推送它们。上面写着“一切都是最新的”。没有分支。我对git非常非常陌生,我不明白到底发生了什么 git remote show origin告诉我: HEAD branch: master Remote branch: master tracked Local ref configured for 'git push': master pushes
git remote show origin
告诉我:
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (up to date)
我能做些什么来理解它不是最新的
谢谢
更新:
git状态
:
# On branch master
# Untracked files:
# (use "git add ..." to include in what will be committed)
#
# histmarkup.el
# vendor/yasnippet-0.6.1c/snippets/
no changes added to commit (use "git add" and/or "git commit -a")
git fsck
:
dangling tree 105cb101ca1a4d2cbe1b5c73eb4a238e22cb4998
dangling tree 85bd0461f0fcb1618d46c8a80d3a4a7932de34bb
编辑:这似乎不是正确的解决方案,请参阅问题的注释。我留下答案是因为git add而不是git commit——一个提示可能会对将来的人有所帮助 您好,您在提交之前添加了吗?差不多
git add .
(别忘了点)
在
git commit -m "what you changed"
(我发现这个网站对你的行动很有用-试试看
git config push.default tracking
:
push.default
定义git push在以下情况下应采取的操作:命令行上未提供任何refspec,远程中未配置任何refspec,并且命令行上提供的任何选项均未暗示任何refspec。可能的值为:
* nothing - do not push anything.
* matching - push all matching branches. All branches having the same name in both ends are considered to be matching. This is the default.
* upstream - push the current branch to its upstream branch.
* tracking - deprecated synonym for upstream.
* current - push the current branch to a branch of the same name.
使用
其中,
yourlocalbranch
可以是master
(可能是您的originmaster本地副本)或任何其他分支。如果不确定,请使用--verbose
和--dry run
选项。您是如何推动的?push命令的输出是什么?git-log--decoration
向您展示了什么?我使用git-push-origin-master
进行了推送。结果是“一切都是最新的”<代码>git日志--装饰显示了3个提交,包括昨天的提交,但不是今天的提交。好吧,这是更严重的问题。如果您已经做了大量的提交,并且当前存储库中不再有这些内容,那么在推送之前就出现了一些问题。当您将master推送到源站时,您的“最新”也就不足为奇了,提交也不在推送的本地端。您能用git status
、git branch-a
和git fsck
的完整输出更新您的问题吗?好的,看起来您已经卸下了头。您没有执行类似于git checkout origin/master
的操作,是吗?@wolf The-a仅在文件已被跟踪的情况下添加一个文件-给add命令一个快照,看看这是否有助于跟踪该文件,并且git status-s
将其正确显示为已修改。在“git commit-a-m”(message)”之后,
它不再显示为已修改。我尝试了git add filename
(因为目录中有些东西我还不想跟踪),但push仍然显示“一切都是最新的”。这就是我的情况。试图将git添加到一个现有文件夹中,其中包含存储库的精确副本,认为我不应该执行git add.
,但这一点是错误的,因为所有内容都是“最新的”。“git config push.default tracking”这是完美的,并更新了我的report谢谢!它解决了我的问题!它发生在我定义一个默认分支来推送'git push upper dev:master'之前,这意味着它将把源代码从dev推送到master。对吧?@巴斯蒂安
git config push.default tracking
* nothing - do not push anything.
* matching - push all matching branches. All branches having the same name in both ends are considered to be matching. This is the default.
* upstream - push the current branch to its upstream branch.
* tracking - deprecated synonym for upstream.
* current - push the current branch to a branch of the same name.
git push upstream yourlocalbranch:master