Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

copy/mv directory to another directory in git

Tags:

I have a

dir1/ contains a lot files and subdirecties, I want to change the directory name to dir2/ . I tried

git mv dir1/ dir2/

I got this message:

fatal: renaming 'dir1' failed: Permission denied 

update:

I ran from git for windows command line http://code.google.com/p/msysgit/
What is the correct command?

like image 292
icn Avatar asked Jul 28 '11 23:07

icn


2 Answers

It could also be that the directory (or a file within) is being used by another program, which prevents you from doing anything with that folder. Only on Windows, obviously.

Use the Process Explorer if you're unsure which program has captured that directory/file.

like image 74
Bram Schoenmakers Avatar answered Sep 20 '22 18:09

Bram Schoenmakers


You can just use standard unix tools, or whatever your OS is. So:

mv dir1 dir2 

should work. Just make sure you add both dir1 and dir2 to the staging area after you've done that, so that you commit the changes.

An example of how to commit the change (once done) could be:

git add dir1 dir2 && git commit dir1 dir2 

There's probably other ways to do it too.

like image 21
Leif Andersen Avatar answered Sep 19 '22 18:09

Leif Andersen