0

I have about 10 directories, each with contents that match this pattern:

x.js
x.d.ts
x.ts

and I want to rename these files to:

index.js
index.d.ts
index.ts

is there a mv or git mv command that I can use to rename the files?

something like:

git mv --match x.* index.*

I am not really sure.

Alexander Mills
  • 90,741
  • 139
  • 482
  • 817

2 Answers2

1

As git does not perform any special rename registration, you can use system utility like rename, then stage the changes. For example with commands:

git add -u
git add <new pattern>
max630
  • 8,762
  • 3
  • 30
  • 55
1

In a directory, you can use the following command:

rename x index x.*

x.* is the pattern. For all matched file, x will be replaced to index but just for the first occurrence.

Thanks!