为什么有“没有提交”的问题?我添加了我的新目录后? [英] Why is there "nothing to commit" after I added my new directory?

查看:163
本文介绍了为什么有“没有提交”的问题?我添加了我的新目录后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这真让我很沮丧。我习惯于与SVN合作,并且对git来说是新手。我已经有一个名为X的文件夹。一个collobarator对X进行了更改并将其提交,然后我对其进行了更新。我对它进行了更改,现在我想将它另存为X2作为新文件夹。所以我在本地复制了X文件夹,现在我想将它添加到github中。所以我做了

$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $' changes
git push origin master

我也试过在父目录中, X和X2的位置,然后git添加X2和提交和推,但我一直得到没有提交。



我做错了什么?

解决方案为什么在添加 X2之前要做一个 git init 。 Git init只在创建回购时完成。另请注意, git add 只会添加文件,而不是目录。 添加X2 应该工作得很好,当你在根/父。从文件夹内部 git add。


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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆