I have a git repository whose structure looks like:
+--repo.git
|
+----+bootstrap.py
+----+buildout.cfg
+----+.gitignore
+----+webapp
|
+---------+manage.py
+---------+modules
+---------+templates
+---------+static
+---------+...
+---------+...
I would like to move the contents of the webapp
folder one level up. My resulting repo should look like:
+--repo.git
|
+----+bootstrap.py
+----+buildout.cfg
+----+.gitignore
+----+manage.py
+----+modules
+----+templates
+----+static
+----+...
+----+...
Can I do this by simply moving all the files of the webapp
directory one level up, deleting the empty webapp
directory and then committing the changes? Would this preserve the commit history of the files under the webapp
directory?
Although a very simple question for many of you, I'd like to be sure. The last thing I'd want is a git soup.
I tried moving the files but I lost the commit history as git doesn't really handle a move or a rename. I do know that even though it shows up as a new file in the logs, it is still possible to view the commit history for the file using some options in git log
.
From what I've read, the best way to accomplish this would be using git-filter
. I'm not very good with shell or git so could someone tell me what I'd need to execute to do the aforementioned.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…