为什么有“没有提交”的问题?我添加了我的新目录后? [英] Why is there "nothing to commit" after I added my new directory?
问题描述
$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $' changes
git push origin master
我也试过在父目录中, X和X2的位置,然后git添加X2和提交和推,但我一直得到没有提交。
我做错了什么?
X2之前要做一个 git init
。 Git init只在创建回购时完成。另请注意, git add
只会添加文件,而不是目录。 添加X2 应该工作得很好,当你在根/父。从文件夹内部Ok this is really frustrating me. I'm used to working with SVN, and am new to git. I had a folder called X in git already. A collobarator made changes to X and commited it, and I updated it. I made changes to it, and now I want to save it as X2 as a new folder. So I duplicated the X folder locally, and now I want to add this to github. So I did
cd X2
git init
git add X2
git commit -m "changes"
git push origin master
I also tried being in the parent directory where both X and X2 are located, then git add X2 and commit and push, but I keep getting "nothing to commit".
What am I doing wrong?
Why are you doing a git init
before adding X2
. Git init is done only when creating a repo. Also note that git add
only adds files, not directories.
Apart from that git add X2
should work perfectly fine, when you are in root / parent. From within the folder itself do git add .
这篇关于为什么有“没有提交”的问题?我添加了我的新目录后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!