脱字符(^)字符是什么意思? [英] What does the caret (^) character mean?

查看:1325
本文介绍了脱字符(^)字符是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到回答了一个问题

a>这里有助于在git中恢复已删除的文件。



解决方案是

  git checkout< deletion_commit> ^  - < deleted_file_path> 

插入符号( ^ )做?我在其他地方看到它在git中做非常有用的事情。它很神奇。有人请为我破坏它并告诉我它做了什么? $ c>表示当前分支尖端的第一个父代。



请记住,git提交可以有多个父代。 HEAD ^ HEAD ^ 1 的缩写,您还可以在 HEAD ^ 2 等等。



你可以得到任何提交的父母,而不仅仅是 HEAD 。您也可以通过几代人回溯:例如, master〜2 表示主分支尖端的祖父母,在不明确的情况下赞成第一父母。这些说明符可以任意链接
eg topic〜3 ^ 2



有关详细信息,请参阅指定修订部分 git rev-parse --help


I saw an answer to a question here that helps restore a deleted file in git.

The solution was

git checkout <deleting_commit>^ -- <deleted_file_path>

What does the caret character (^) do? I’ve seen it elsewhere doing very useful things in git. It’s magical. Someone please spoil it for me and tell me what it does?

解决方案

HEAD^ means the first parent of the tip of the current branch.

Remember that git commits can have more than one parent. HEAD^ is short for HEAD^1, and you can also address HEAD^2 and so on as appropriate.

You can get to parents of any commit, not just HEAD. You can also move back through generations: for example, master~2 means the grandparent of the tip of the master branch, favoring the first parent in cases of ambiguity. These specifiers can be chained arbitrarily , e.g., topic~3^2.

For the full details, see the "Specifying Revisions" section of git rev-parse --help.

这篇关于脱字符(^)字符是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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