Change git directory to previous

I have a project directory, for example / projects / myProject / src / ... and my git repository is in the / projects / myProject / src directory. But I want to change my main git directory to / projects / myProject (which is the parent of the current git directory). I could just create a new repo in / projects / myProject, but I could lose all my previous commits. Is there a way to change my directory without losing my commit data?

+3
source share
1 answer
  • In the folder, /srcgo from *to ./src, so now your code should be in /src/src. If you make the move correctly, it will save the entire history of changes.
  • /myproject/ /myproject/src, .
  • /myproject/src /myproject/myproject, .

.

:

  • /Myproj.make
  • /src/.git
  • /src/myproj.cpp

:

  • /Myproj.make
  • /src/.git
  • /src/src/myproj.cpp

:

  • /src/.git
  • /src/Myproj.make
  • /src/src/myproj.cpp
  • [COMMIT]

:

  • /.git
  • /Myproj.make
  • /src/myproj.cpp
  • [DONE]
+4

Source: https://habr.com/ru/post/1760182/


All Articles