如何将新文件夹(包含其他文件夹和文件)推送到现有的 git 存储库? [英] How to push a new folder (containing other folders and files) to an existing git repo?

查看:31
本文介绍了如何将新文件夹(包含其他文件夹和文件)推送到现有的 git 存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 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 add 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 存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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