0

So I put git into folder B, but it needs to be in folder C. Folders go A>B>C

I'm worried to just move folder C to folder A because some of the files are already using their current path available to them.

Is there a clean way to just move the repo from B to C?

(Using Mac/Unix)

Josh Bubis
  • 21
  • 3

2 Answers2

1

you can use git mv to move files to the new location.

git mv <old path> <new path>

Read this to learn more about it:

https://githowto.com/moving_files

Also take a look on this question if you need something more complex:

How do I Re-root a git repo to a parent folder while preserving history?

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
1

As far as Git is concerned, you can just move the directory to a new location. Git stores all of its internal metadata in the hidden .git directory contained within the root directory so if you move the root, that will move with it.

Scott
  • 13,735
  • 20
  • 94
  • 152
  • Doing so will result in the files to be tracked as new files since the paths has been modified. – CodeWizard Mar 23 '16 at 20:51
  • No it won't. I just set up a test repository, added a commit and then moved the directory to a brand new location on my drive. `git status` shows "nothing to commit, working directory clean" and `git log` shows my test commit. – Scott Mar 23 '16 at 20:55