ayushmat316
ayushmat316

Reputation: 135

Github folder structure change

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?

Upvotes: 8

Views: 4564

Answers (1)

SzG
SzG

Reputation: 12609

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.

Upvotes: 6

Related Questions