问题描述
我使用 git clone sshurl
将存储库克隆到了台式机。不出所料,这在我的桌面上创建了一个文件夹。
I cloned a repository to my desktop machine using git clone sshurl
. As expected, this created a folder in my desktop.
现在,我想将整个文件夹推入git中,而不是单个文件。例如,我克隆的文件夹名为 project_iphone
。现在我将另一个名为 my_project
的文件夹添加到 project_iphone
中。 my_project
文件夹也包含许多文件和文件夹。
Now, instead of a single file, I want to push a whole folder into git. For example, the folder that I cloned is named project_iphone
. Now I add another folder called my_project
into project_iphone
. The my_project
folder contains lots of files and folders as well.
我的问题是,我应该如何将 my_project
文件夹推送到服务器?
My question is, how should I push my_project
folder to the server?
分步说明会很有帮助。
谢谢。
推荐答案
您需要 git add my_project
暂存新文件夹。然后 git添加my_project / *
暂存其内容。然后使用 git commit
提交上演的内容,最后使用 git push origin master
将更改推回源(我假设您希望推送到master分支。)
You need to git add my_project
to stage your new folder. Then git add my_project/*
to stage its contents. Then commit what you've staged using git commit
and finally push your changes back to the source using git push origin master
(I'm assuming you wish to push to the master branch).
这篇关于如何将新文件夹(包含其他文件夹和文件)推送到现有的git repo?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!