git 在 github 中移动文件和文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23978931/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:04:19  来源:igfitidea点击:

Move files & folders in github

gitgithub

提问by TheAlPaca02

I need to set up a github for a school project but Im getting lost in the complicated workings of it.

我需要为一个学校项目建立一个 github,但我迷失在它复杂的工作中。

I managed to push the contents of a folder to my repository but since I need to add other files and want to keep some structure I want to take the current files & folder I have and move them into a new directory.

我设法将文件夹的内容推送到我的存储库,但由于我需要添加其他文件并希望保留一些结构,因此我想获取我拥有的当前文件和文件夹并将它们移动到新目录中。

For example, I want to change the following:

例如,我想更改以下内容:

Master
  Folder X
  Folder Y
  File Z

To

Master
  Project 1
    Folder X
    Folder Y
    File Z

How do I do this exactly? I've found similar posts with similar explanations but I never understood any of them.. Could some please explain this in an easy fashion? Because I've been trying without success for nearly two hours now.

我该怎么做?我发现类似的帖子有类似的解释,但我从来没有理解它们中的任何一个..有人可以用简单的方式解释一下吗?因为我已经尝试了将近两个小时但没有成功。

采纳答案by griffon vulture

Move files as you want in your local folder

根据需要在本地文件夹中移动文件

and after that simply commit all changes in git bash:

之后只需在 git bash 中提交所有更改:

git add "Project 1"
git commit -am "change folders layout"

and push changes:

并推送更改:

git push