git-mv的目的是什么? [英] What's the purpose of git-mv?

查看:129
本文介绍了git-mv的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,Git并不需要跟踪 file 重命名/移动/复制操作,那么真正的目的
git mv ?手册页不是特别描述性的...



是否过时?它是一个内部命令,不打算由普通用户使用吗?

mv oldname newname

只是简写:

  mv oldname newname 
git add newname
git rm oldname

即它会自动更新旧路径和新路径的索引。


From what I understand, Git doesn't really need to track file rename/move/copy operations, so what's the real purpose of git mv? The man page isn't specially descriptive...

Is it obsolete? Is it an internal command, not meant to be used by regular users?

解决方案

git mv oldname newname

is just shorthand for:

mv oldname newname
git add newname
git rm oldname

i.e. it updates the index for both old and new paths automatically.

这篇关于git-mv的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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