无法在GitHub上看到推送的提交记录

3
我在Coursera上参加了一个任务,需要fork一个repo,克隆一个本地版本,进行修改并提交,然后推送这些更改。我已经完成了以上所有步骤。但是当我检查我的repo URL时,我无法看到我刚刚做出的提交?https://github.com/gcameron89777/ProgrammingAssignment2。我使用git config来为用户名和电子邮件设置全局值。我进入了有关目录中隐藏的.git文件夹的实际文件,并查看了config文件:
url = https://github.com/gcameron89777/ProgrammingAssignment2.git

现在当我访问URL时,我看不到我的任何提交。我不应该看到吗?
1. 我编辑了相关的.R文件并保存了。 2. 然后我使用commit,就像这样:git commit -m“添加函数makeCacheMatrix和cacheMatrix” 3. 然后我使用 git push 进行推送。 所有这些操作都是在当前目录下进行的。
我不应该看到我刚刚做的最新提交吗?
编辑: 以下是git status和git log的输出:
RMIOMP1310:ProgrammingAssignment2 gavin.cameron$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   cachematrix.R

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    .DS_Store

no changes added to commit (use "git add" and/or "git commit -a")
MRMIOMP1310:ProgrammingAssignment2 gavin.cameron$ git log
commit 7f657dd22ac20d22698c53b23f0057e1a12c09b7
Author: Roger D. Peng [amelia] <rdpeng@gmail.com>
Date:   Tue Apr 22 10:09:22 2014 -0400

    More typos

commit 873d883cbbc6de667b66349c96148203cdbbb8b1
Merge: 9b22d21 4f84c6f
Author: Roger D. Peng <rdpeng@gmail.com>
Date:   Tue Apr 22 10:06:30 2014 -0400

    Merge pull request #1 from gustavdelius/master

    Fixed some minor typos.

commit 9b22d21e3671f46bf535624bbb769786840d05ba
Author: Roger D. Peng [amelia] <rdpeng@gmail.com>
Date:   Mon Apr 21 12:35:04 2014 -0400

    Clarify instructions about forking/cloning

commit 4f84c6fc9c58cfcfeb788e74fbde63549ff20100
Author: Gustav Delius <gustav.delius@gmail.com>
Date:   Tue Apr 8 22:11:14 2014 +0100

    Fixed some minor typos.

commit e4eed4153bd237a2dd4532fc3f40ce0e22fd0cb7
Author: Roger D. Peng [amelia] <rdpeng@gmail.com>
Date:   Tue Jan 14 17:16:07 2014 -0500

    A few more comments on what to do

commit 05bf4b3c78e2c1d679f0c94ae0431a281a9a137d
Author: Roger D. Peng [amelia] <rdpeng@gmail.com>
Date:   Tue Jan 14 17:10:40 2014 -0500
:

2
也许你忘记了add你的文件?请运行git statusgit log并向我们展示输出。 - roman-roman
@roman.brodetski 我已添加了这些命令的输出。我有点不确定 - 我是否提交到了错误的代码库?上面的提交看起来像是来自课程教师,而不是我的。 - Doug Fir
1个回答

3

来自git status的输出:

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified:   cachematrix.R

你没有将文件添加到提交中 - 所以基本上你什么也没提交。

请执行以下操作:

git add -A
git commit -m "<commit message>"
git push

如果您想更好地了解Git的工作方式,请阅读以下内容:http://git-scm.com/docs/gittutorial

非常感谢,我现在看到它在运行了。我漏掉了“add”这一步,我想这告诉了git要推送哪个文件。我也会看一下教程的。 - Doug Fir
好的。是的,它指出了要“提交”的文件。 - roman-roman

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接