2

I'm trying to search on the web a way to rename all the files in a directory and move all the contents of that directory one level up inside another directory using git.

For example, replace "run" with ruin"

Directory a/b/c contains:
run1.txt
run2.txt
runner.txt
file.txt

Result: 
Directory a/d/ contains:
ruin1.txt
ruin2.txt
ruiner.txt
file.txt
xan
  • 4,640
  • 13
  • 50
  • 83
  • 1
    Just rename the files like you normally would and then afterwards add the changes to Git. No need to make Git do the renames. – poke Mar 20 '14 at 01:48
  • you can use git mv (https://www.kernel.org/pub/software/scm/git/docs/git-mv.html) – Xavier S. Mar 20 '14 at 01:49
  • As @poke said. Easier to do with your shell and Then commit the change. Zmv is you use zsh can rename with Regex as opposed to doing them individually. – Doon Mar 20 '14 at 01:52

1 Answers1

1

If you do move the files yourself (without git), then you would need a:

git add -A

That way, git will detect the changes. See "What's the difference between git add . and git add -u?": git will detect the additions and the deletions, and deduce from it the moves.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250