Git - 将文件的内容移动到另一个目录 [英] Git - Move the contents of a file into another directory

查看:3538
本文介绍了Git - 将文件的内容移动到另一个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将一个目录或单个文件的内容移动到另一个目录?

我做了以下 git mv Jarryd / movementcommands .c src



得到这个
致命:不在版本控制下,source = Jarryd / movementcommands .c,destination = src / movementcommands.c



应如何移动?



像这样 git mv Jarryd / movementcommands.c src / movementcommands.c

解决方案

这两个表单都应该可以工作,但是因为你的源文件不在git的控制下,所以你不需要 git mv ,需要一个简单的移动和添加。 (我假设Jarryd和src都在你的git工作树中。)

  mv Jarryd / movementcommands.c src 
git add src / movementcommands.c


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 ?

解决方案

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

这篇关于Git - 将文件的内容移动到另一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆