github - 初学git 想add整个文件夹 但出现了问题 想请教各位大手
本文介绍了github - 初学git 想add整个文件夹 但出现了问题 想请教各位大手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
我创建了一个本地仓库 将整个文件夹移到了仓库里 但是add完以后 git status查看时出现以下情况
这是仓库的样子
git commit后也是这样
求大神告诉我这是什么情况
解决方案
你应该是 git add --all
以后 修改了 dapingmu 内的文件了 所以显示和你图内的一样
每次修改文件后都需要 stage 目标文件的 不然是不能commit 的
如下操作 获得返回结果和题主一样:
D:\PHP\Tmp
λ mkdir GitAdd
D:\PHP\Tmp
λ cd GitAdd\
D:\PHP\Tmp\GitAdd
λ ls
D:\PHP\Tmp\GitAdd
λ git init
Initialized empty Git repository in D:/PHP/Tmp/GitAdd/.git/
D:\PHP\Tmp\GitAdd (master)
λ mkdir dapingmu
D:\PHP\Tmp\GitAdd (master)
λ git status
On branch master
Initial commit
nothing to commit (create/copy files and use "git add" to track)
D:\PHP\Tmp\GitAdd (master)
λ ll
total 8
drwxr-xr-x 1 zykj 197121 0 8月 4 17:12 .
drwxr-xr-x 1 zykj 197121 0 8月 4 17:12 ..
drwxr-xr-x 1 zykj 197121 0 8月 4 17:12 .git
drwxr-xr-x 1 zykj 197121 0 8月 4 17:12 dapingmu
D:\PHP\Tmp\GitAdd (master)
λ cd dapingmu\
D:\PHP\Tmp\GitAdd\dapingmu (master)
λ touch test.txt
D:\PHP\Tmp\GitAdd\dapingmu (master)
λ cd ..
D:\PHP\Tmp\GitAdd (master)
λ git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
dapingmu/
nothing added to commit but untracked files present (use "git add" to track)
D:\PHP\Tmp\GitAdd (master)
λ git add --all
D:\PHP\Tmp\GitAdd (master)
λ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: dapingmu/test.txt
D:\PHP\Tmp\GitAdd (master)
λ echo 123 >> dapingmu\test.txt
D:\PHP\Tmp\GitAdd (master)
λ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: dapingmu/test.txt
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: dapingmu/test.txt
D:\PHP\Tmp\GitAdd (master)
λ git commit -m "not add modified file"
[master (root-commit) d5e1197] not add modified file
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 dapingmu/test.txt
D:\PHP\Tmp\GitAdd (master)
λ git status
On branch 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: dapingmu/test.txt
no changes added to commit (use "git add" and/or "git commit -a")
这篇关于github - 初学git 想add整个文件夹 但出现了问题 想请教各位大手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文