Reputation: 2662
I am in need of the exact command to move a file from a directory to another. Lets say move a file (file1.txt) in my Downloads directory to my current directory (version-control/newfolder) in git bash using git command?
I tried this command initially
mv ~/Downloads lesson_3_reflecton_prompts.txt
and it moved my Downloads directory to my version-control/newfolder direcotry and also changed the path of the Downloads directory.
I tried this other commad
mv Downloads/file1.txt file1.txt
and I got this error
mv: cannot stat 'Downloads/file1.txt': No such file or directory
I know there is a code to do this, I need it, and I have been searching for it.
Help
Upvotes: 0
Views: 7139
Reputation: 38136
Use below commands to move file1.txt
from Downloads
directory to your git repo:
mv ~/Downloads/file1.txt file1.txt
And if you want to commit the file1.txt
into your git repo, you can use the commands:
git add file1.txt
git commit -m 'add a file'
Upvotes: 3