Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - Move the contents of a file into another directory

Tags:

git

How does one move the contents of a directory or a single file to another directory?

I did the following git mv Jarryd/movementcommands.c src

and got this fatal: not under version control, source=Jarryd/movementcommands.c, destination=src/movementcommands.c

How should it be moved?

like this git mv Jarryd/movementcommands.c src/movementcommands.c ?

like image 982
some_id Avatar asked Feb 24 '23 10:02

some_id


1 Answers

Both forms should work but because your source file isn't under git's control you don't need git mv, a simple move and add is needed. (I assume that both Jarryd and src are in your git working tree.)

mv Jarryd/movementcommands.c src
git add src/movementcommands.c
like image 71
CB Bailey Avatar answered Feb 27 '23 07:02

CB Bailey