Github文件夹结构发生变化 [英] Github folder structure change

查看:127
本文介绍了Github文件夹结构发生变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Github进行网站项目。我一直在检查一段时间的变化,但我现在想改变我的文件夹结构,基本上更好地组织文件。这会搞乱我的Github存储库吗?如果是,对我来说,确保我的版本保持不变并且我的新文件夹结构与Git同步的最佳方式是什么?

解决方案

在Git方面,这些将是简单的文件重命名。为了简单起见,使用git命令进行重组: old_dirname new_dirname
git commit

正如您所看到的,您可以重命名单个文件或整个目录

Git可以在各个重命名文件中关注各个文件历史记录:

  git log --follow bar.c 

为了让git变得简单,如果您重命名或移动文件,请不要在同一提交中更改其内容。


I am using Github for a website project. I have been checking in changes for a while now, but I now want to change my folder structure, basically organize the files better. Will this mess up my Github repository? If yes, what's the best way for me to ensure my versions stay intact and my new folder structure is synchronized with Git?

解决方案

In terms of Git, these will be simple file renames. To keep things simple, do the restructuring with git commands:

git mv foo.c bar.c
git mv old_dirname new_dirname
git commit

As you can see, you can rename individual files or entire directories as well.

Git is able to follow individual file histories across renames:

git log --follow bar.c

To make life easy for git, if you rename or move a file, do not change its contents in the same commit.

这篇关于Github文件夹结构发生变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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