首先,我是一个github新手:
我创建了一个新的存储库,从另一个repo导入代码,将repo克隆到我的磁盘,将更改的文件复制到其中,称为git commit
和git push
但是如果我转到我的github帐户,打开回购,我没有看到我的最新提交,文件也没有反映我在磁盘上的最新信息,但我得到以下内容:
$ git pull
Already up-to-date.
$ git commit
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
modified: main.cpp
modified: mainwindow.cpp
modified: mainwindow.h
modified: session.cpp
modified: sessionstack.cpp
modified: sessionstack.h
Untracked files:
cscope.out
kterminal.kdev4
no changes added to commit
$ git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Username for 'https://github.com': myuser
Password for 'https://myuser@github.com':
Everything up-to-date
我做错了什么? :○
答案 0 :(得分:2)
您需要在git add
之前执行git commit
使用git add .
会很常见,这会使" stage"要提交的所有更改。 (即将它们标记为包括在下一次提交中)。
"添加"的目的提交文件之前的文件意味着您不必一次提交所有更改。例如,您可以更改十个文件,第五个文件,使用消息"功能一个"提交它们,然后暂存剩下的5个文件并将其提交为"功能二"