0

So I have a git repo with the following structure:

cartridges
    mainapp
    helpers
    utils

I want to essentially move everything within cartridges up one level and remove cartridges. So all the folders inside the cartridges folder are at the root level themselves. But I want to preserve the last commit on every file so I can glance at github and see what was last touched 3 years ago etc.

mainapp
helpers
utils

I found this answer: Moving a git repository up one hierarchy level

But I'm not sure how to adapt that for my case.

time git filter-branch --index-filter 'git ls-files -s |
     sed "s-\t\"*-&webroot/-" |
     GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && 
 mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' --tag-name-filter cat -- --all
Community
  • 1
  • 1
Josh
  • 13
  • 2

1 Answers1

0

You could still move them and make a commit, but when you're checking the log you can ignore files that are renamed using --diff-filter. e.g.

$ for a in $(ls); 
do git log --diff-filter=M --pretty=format:"%h%x09%an%x09%ad%x09$a" -1 -- "$a"; 
done
Keif Kraken
  • 5,084
  • 1
  • 7
  • 11