To start, I'm aware this question has been asked before here. The thing is that I do like to keep the history.
So I tried out all of the other steps I could find which involve either moving the .git directory one level up or creating a subdirectory and moving all the files from the current root into that. But I keep on losing the history of my files.
The funny thing is that Git Bash (so on my local commmand line) tells me it detects the files as being renamed and when I run git log
I also get the history of the file as I'd expect it. But when I look on github, the history is gone and the commit only contains a list of files being removed and added (instead of a list of renames, which I'd expect).
The repository I'm talking about is this one. There's a branch called "Moving" in which I tried to move the files around.
In case it helps, the exact steps I took were:
- Create the subdirectory "src" in the directory which contains .git
- Move all the files into that subdirectory
- Move the directories from the level above where .git is, one level down
- Run a
git add src
andgit add nbproject
where src is the subdirectory I created in step 1 and nbproject a directory I moved down in step 3 - Run a
git rm
for all "old files" - Run a
git status
and note that all files are detected as being renamed - Run a
git log src/README
to make sure the history is OK - Finally commit the change to github
- Note that the history is gone when I look at my README on github