GIT - 推送到(GitHub)源大师什么都不做

Nip*_*rus 16 git github

我已经分叉了某人的GIT存储库:

https://github.com/nippysaurus/toodledo-objc
Run Code Online (Sandbox Code Playgroud)

将其克隆到我的本地计算机,显示原点并提供以下信息:

* remote origin
  Fetch URL: https://nippysaurus@github.com/nippysaurus/toodledo-objc.git
  Push  URL: https://nippysaurus@github.com/nippysaurus/toodledo-objc.git
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)
Run Code Online (Sandbox Code Playgroud)

当我将我的更改推送到"origin master"时,git会打印出"最新的一切",但在我的GitHub仓库中没有更新任何内容.

这里发生了什么?

编辑:

有人建议我检查文件是否实际提交...文件被提交,我向你保证.

commit 0d3a21616d82c8e5a89baaf85d745fc2cfdf614f
Author: nippysaurus <nippysaurus@example.com>
Date:   Wed Jun 1 13:19:14 2011 +1000

    updated readme
Run Code Online (Sandbox Code Playgroud)

这是更新的文件:

commit 0d3a21616d82c8e5a89baaf85d745fc2cfdf614f
Author: nippysaurus <nippysaurus@example.com>
Date:   Wed Jun 1 13:19:14 2011 +1000

    updated readme

diff --git a/README.mdown b/README.mdown
index fb8ee14..a71aa57 100644
--- a/README.mdown
+++ b/README.mdown
@@ -3,7 +3,7 @@ toodledo-objc

 An _unofficial_ toodledo-API implementation in ObjectiveC.

-This library currently uses [version 1.0 of the API](http://www.toodledo.com/info/api_doc.php "Toodledo API 1.0 spec") which has been offic
+This library currently uses [version 1.0 of the API](http://www.toodledo.com/info/api_doc.php "Toodledo API 1.0 spec") which has been offic

 Supported:
Run Code Online (Sandbox Code Playgroud)

此外,我可以看到该文件的本地版本与GitHub上的版本非常不同,更改肯定会添加到我的本地存储库,但不会被推送到远程仓库.

ral*_*nja 31

可能是您在另一个分支而不是主分支的情况下,然后键入:

git push origin HEAD:master
Run Code Online (Sandbox Code Playgroud)

所以git理解你想要推高当前的HEAD而不是主分支.


swo*_*ish 9

当它说最新时它意味着您的本地存储库和您的远程存储库是同一个,即您没有对需要推送到远程仓库的本地仓库进行任何更改.

如果您确实更改了文件,那么您必须忘记提交它.

如果您已创建新文件,则必须添加它.要添加文件使用

git add .
Run Code Online (Sandbox Code Playgroud)

然后提交所有编辑过的文件使用

git commit -am "Commit message"
Run Code Online (Sandbox Code Playgroud)

然后做

git push origin master
Run Code Online (Sandbox Code Playgroud)

  • 请在适当的时候使用四个空格缩进或反引号格式化您的答案.谢谢! (2认同)