您好Git有问题,希望有人能给我一些帮助。
/`\
/ : |
_.._ | '/
/` \ | /
| .-._ '-"` (
|_/ / o o\
| = () )= FOLLOW THE WHITE RABBIT!
\ '--`/
/ ---<`
| , \\
| | \\_
/ ; |.__)
(_/.-. ;
{ `| \_/
'-\ / |
| / |
/ \ '-.
\__|----'
Last login: Wed Feb 19 13:28:48 2014 from xxx.xxx.xxx.xxx
登录并做一些事情
user@matrix:~$ cd htdocs/blabla.de/
user@matrix:~/htdocs/blabla.de$ git status
# On branch master
nothing to commit (working directory clean)
user@matrix:~/htdocs/blabla.de$ git pull origin master
Enter passphrase for key '/home/any/path/.ssh/id_rsa':
From ssh://git.ownserver.de:22/any/project
* branch master -> FETCH_HEAD
Already up-to-date.
user@matrix:~/htdocs/blabla.de$ git checkout dev
Switched to branch 'dev'
user@matrix:~/htdocs/blabla.de$ git pull origin dev
Enter passphrase for key '/home/any/path/.ssh/id_rsa':
From ssh://git.ownserver.de:22/any/project
* branch dev -> FETCH_HEAD
Already up-to-date.
user@matrix:~/htdocs/blabla.de$ git checkout master
Switched to branch 'master'
为某些样式更改创建了我的新分支
user@matrix:~/htdocs/blabla.de$ git checkout -b cal/style
Switched to a new branch 'cal/style'
使用IDE更改样式
user@matrix:~/htdocs/blabla.de$ git status
# On branch cal/style
# 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: fileadmin/templates/css/reiseseiten.css
#
no changes added to commit (use "git add" and/or "git commit -a")
将已更改的文件添加到索引
user@matrix:~/htdocs/blabla.de$ git add fileadmin/templates/css/reiseseiten.css
提交更改
user@matrix:~/htdocs/blabla.de$ git commit -m '11715 Hintergrundfarbe bei Modulen (CAL)'
[cal/style aada6a3] 11715 Hintergrundfarbe bei Modulen (CAL)
1 file changed, 3 insertions(+), 3 deletions(-)
mode change 100644 => 100755 fileadmin/templates/css/reiseseiten.css
切换到主
user@matrix:~/htdocs/blabla.de$ git checkout master
Switched to branch 'master'
将更改合并到主文件
user@matrix:~/htdocs/blabla.de$ git merge cal/style
Updating b3260c3..aada6a3
Fast-forward
fileadmin/templates/css/reiseseiten.css | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
mode change 100644 => 100755 fileadmin/templates/css/reiseseiten.css
推入存储库 - &gt;没有错误
user@matrix:~/htdocs/blabla.de$ git push origin master
Enter passphrase for key '/home/any/path/.ssh/id_rsa':
Counting objects: 11, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 554 bytes, done.
Total 6 (delta 5), reused 0 (delta 0)
To ssh://git@git.ownserver.de:22/any/project.git
b3260c3..aada6a3 master -> master
在Firebug中添加其他一些东西(不在此GitRepo的任何文件中)
20分钟后检查项目状态(这只是一个本地项目,我只能访问)
user@matrix:~/htdocs/blabla.de$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: fileadmin/templates/css/reiseseiten.css
#
# 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: fileadmin/templates/css/reiseseiten.css
#
我查找了提交时间(17:18)以及文件系统内部文件的最后更改时间。
两者的时间相同,因此在提交
后没有人更改此文件user@matrix:~/htdocs/blabla.de$ git log
commit aada6a375bce002c26910afea6024c40c6f754a1
Author: Christian user <user@me.de>
Date: Wed Feb 19 17:18:14 2014 +0100
11715 Hintergrundfarbe bei Modulen (CAL)
认为这是副作用,并且已经完成了获取
user@matrix:~/htdocs/blabla.de$ git fetch
Enter passphrase for key '/home/any/path/.ssh/id_rsa':
但是我错了,没有副作用,但是这是什么?
user@matrix:~/htdocs/blabla.de$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: fileadmin/templates/css/reiseseiten.css
#
# 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: fileadmin/templates/css/reiseseiten.css
#
查看Diff内部,看看这是我上一次提交的更改。
怎么了?
答案 0 :(得分:0)
这似乎与这个问题类似:Git lists same file modified and not staged for commit?
如果您对文件进行了更改,使用Changes to be committed
添加了文件,然后另外添加了文件,则可以将同一文件标记为Changes not staged for commit
和 git add
之后发生了变化。