git git提交目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4425082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git commit directory
提问by LuxuryMode
I created a repo and, locally, dragged-and-dropped an existing project directory into the repo. I then did something like git add directory/ and committed it and pushed it. When I look at my repo on github though, all i see is the directory with no subfolders, no content. How do I push all of the files and subfolders of that project to the repo?
我创建了一个 repo,并在本地将现有的项目目录拖放到了 repo 中。然后我做了一些类似 git add directory/ 的事情,并提交并推送它。但是,当我在 github 上查看我的 repo 时,我看到的只是没有子文件夹,没有内容的目录。如何将该项目的所有文件和子文件夹推送到存储库?
采纳答案by David Laing
If the files are in your local commit, then they should be displayed on Github.
如果文件在您的本地提交中,那么它们应该显示在 Github 上。
Load up gitk (just type gitk from your Git bash command prompt); and check to see whether all the files below the folder were actually added in the commit you pushed to Github.
加载 gitk(只需在 Git bash 命令提示符下输入 gitk 即可);并检查文件夹下的所有文件是否真的添加到您推送到 Github 的提交中。
If they weren't, and a git add . doesn't seem to be working, check that your .gitignore isn't excluding them for some reason.
如果不是,则 git add 。似乎不起作用,请检查您的 .gitignore 是否出于某种原因没有将它们排除在外。
回答by Gauthier
Try this:
尝试这个:
$ git add directory/*
(or *.h, *.c, and so on).
(或 *.h、*.c 等)。
and then check as Aaronontheweb suggests (with gitk
or git status
) that the files are included in the staging area. Not only the folder name.
然后按照 Aaronontheweb 的建议(使用gitk
或git status
)检查文件是否包含在暂存区中。不仅是文件夹名称。
回答by Aaronontheweb
Try git add .
from the base project folder - this should recursively add all files to the repo.
git add .
从基础项目文件夹尝试- 这应该递归地将所有文件添加到存储库。
回答by Garry Bains
Try :$ git add directory1 directory2 director3
This will add the above directories along with all the files present in respective directory.
You can conform by :$ git status
This should show all the files that will be present in next commit.
尝试:$ git add directory1 directory2 director3
这将添加上述目录以及相应目录中存在的所有文件。
您可以通过以下方式符合:$ git status
这应该显示将在下一次提交中出现的所有文件。