我正在推送一些提交,然后想要将其他文件暂存为另一个提交,但是推送也推送了未分段的文件。我做错了什么? unstaged提交是如何推动的呢?
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$
答案 0 :(得分:7)
您没有任何未暂停的更改。 git commit -a
在提交之前对所有更改进行分阶段。您只需要git commit
提交以前暂存的更改。
答案 1 :(得分: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已经知道了。
答案 2 :(得分:2)
git commit -a
会在提交之前自动暂存所有已更改(和跟踪)的文件。
请参阅"Skipping the Staging Area" section in the "Pro Git" book。