2014-05-23 110 views
3

我正在處理Coursera上的一項任務,我們必須分叉回購,克隆本地版本,進行更改並提交然後推送它們。在github上看不到推送提交

我做了所有這些。但是,當我檢查我的回購網址時,我無法看到我剛剛提交的推送提交? https://github.com/gcameron89777/ProgrammingAssignment2

我使用git config來設置用戶名和電子郵件的全局值。我走進在有關目錄中的隱藏文件夾git的的實際文件,看了看配置文件:

url = https://github.com/gcameron89777/ProgrammingAssignment2.git 

現在,當我訪問的URL,我沒有看到任何我提交的。我不應該嗎?

  1. 我編輯了有問題的.R文件並保存了它。
  2. 然後我用承諾,像這樣:git commit -m "added functions makeCacheMatrix and cacheMatrix"
  3. 我然後使用git push

所有,而我的當前目錄是有問題的目錄推。

我應該看不到最近剛剛提交的提交嗎?

編輯: 這裏是git的地位和git日誌輸出:

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] <[email protected]> 
Date: Tue Apr 22 10:09:22 2014 -0400 

    More typos 

commit 873d883cbbc6de667b66349c96148203cdbbb8b1 
Merge: 9b22d21 4f84c6f 
Author: Roger D. Peng <[email protected]> 
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] <[email protected]> 
Date: Mon Apr 21 12:35:04 2014 -0400 

    Clarify instructions about forking/cloning 

commit 4f84c6fc9c58cfcfeb788e74fbde63549ff20100 
Author: Gustav Delius <[email protected]> 
Date: Tue Apr 8 22:11:14 2014 +0100 

    Fixed some minor typos. 

commit e4eed4153bd237a2dd4532fc3f40ce0e22fd0cb7 
Author: Roger D. Peng [amelia] <[email protected]> 
Date: Tue Jan 14 17:16:07 2014 -0500 

    A few more comments on what to do 

commit 05bf4b3c78e2c1d679f0c94ae0431a281a9a137d 
Author: Roger D. Peng [amelia] <[email protected]> 
Date: Tue Jan 14 17:10:40 2014 -0500 
: 
+2

也許,你忘了'add'你的文件嗎?請運行'git status'和'git log'並向我們顯示輸出 –

+0

@roman.brodetski我已經添加了這些命令的輸出。我有點不確定 - 我是否承諾錯誤的回購?上面的提交看起來像來自課程導師,而不是我自己的 –

回答

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 

你沒有add您的文件提交 - 所以你基本上沒有做任何事情。

做以下操作:

git add -A 
git commit -m "<commit message>" 
git push 
如果你想有更好的理解作品的git如何,請仔細閱讀本

http://git-scm.com/docs/gittutorial

+0

非常感謝我現在看到它的工作。我錯過了「添加」這個步驟,我認爲它會告訴git要推送哪個文件。請看看這個教程 –

+0

好的。是的,它表示哪些文件要「提交」 –