1

我正在推送一些提交,然后想将其他文件暂存以进行另一次提交,但是推送也推送了未暂存的文件..我做错了什么?非分阶段提交是如何随着推送而上升的?

kirk:bear.com kirk$ git status
# On branch development
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
# modified:   app/fonts/bear.eot
# modified:   app/fonts/bear.otf
# modified:   app/fonts/bear.svg
# modified:   app/fonts/bear.ttf
# modified:   app/fonts/bear.woff
# modified:   app/styles/global/text/bear/glyphs.less
# modified:   app/views/partials/global/actions.html
#
# 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:   app/styles/core/components.less
# modified:   app/styles/core/container.less
#
kirk:bear.com kirk$ git commit -a
[development 254d21c] fix(Style): Add "followers" and "following" icon as new three people icon. Switched "following" icon in "Me" modal.
 9 files changed, 18 insertions(+), 2 deletions(-)
 rewrite app/fonts/bear.eot (80%)
 rewrite app/fonts/bear.otf (99%)
 rewrite app/fonts/bear.svg (99%)
 rewrite app/fonts/bear.ttf (78%)
 rewrite app/fonts/bear.woff (99%)
kirk:bear.com kirk$ git push
Counting objects: 39, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (20/20), 33.09 KiB | 0 bytes/s, done.
Total 20 (delta 13), reused 0 (delta 0)
To git@github.com:BigBear/bear.com.git
   c70ca7c..254d21c  development -> development
kirk:bear.com kirk$ git status
# On branch development
nothing to commit, working directory clean
kirk:bear.com kirk$ git status
# On branch development
nothing to commit, working directory clean
kirk:bear.com kirk$
4

3 回答 3

7

您没有任何未分阶段的更改。git commit -a在提交之前暂存所有更改。您只想git commit提交先前分阶段的更改。

于 2013-10-16T20:04:48.753 回答
2

这些可能是未暂存的文件,但它们不是未跟踪的:

# modified:   app/styles/core/components.less
# modified:   app/styles/core/container.less

从 git-commit 的手册页:

-a
--all
Tell the command to automatically stage files that have been modified and deleted,
but new files you have not told git about are not affected.

当你这样做时git commit -a,你也抓住了那些。Git 已经知道它们了。

于 2013-10-16T20:05:34.677 回答
2

git commit -a在提交之前自动暂存所有更改(和跟踪)的文件。

请参阅“Pro Git”一书中的“跳过暂存区”部分

于 2013-10-16T20:05:47.953 回答