使用 git 命令将文件从目录移动到我的当前目录

Moving files from a directory to my current directory using git command

我需要将文件从一个目录移动到另一个目录的确切命令。假设使用 git 命令将我的下载目录中的文件 (file1.txt) 移动到 git bash 中的当前目录 (version-control/newfolder)?

我最初尝试过这个命令

mv ~/Downloads lesson_3_reflecton_prompts.txt

并将我的下载目录移动到我的 version-control/newfolder 目录,还更改了下载目录的路径。

我试过这个其他命令

mv Downloads/file1.txt file1.txt

我遇到了这个错误

mv: cannot stat 'Downloads/file1.txt': No such file or directory

我知道有一个代码可以做到这一点,我需要它,我一直在寻找它。

帮助

使用以下命令将 file1.txtDownloads 目录移动到您的 git 存储库:

mv ~/Downloads/file1.txt file1.txt

如果您想将 file1.txt 提交到您的 git 存储库中,您可以使用以下命令:

git add file1.txt
git commit -m 'add a file'