a basic example of the read-tree command usage

后端 未结 2 1642
花落未央
花落未央 2020-12-17 04:39

I was having an issue with renaming a file and was given a solution which included two git commands - git read-tree -i HEAD and git checkout-index -a -f

2条回答
  •  余生分开走
    2020-12-17 04:59

    The read-tree command takes a git tree object and copies its state into the index. In your case you are taking the tree currently marked as HEAD and resetting the index to match this tree - that is equivalent to git reset --mixed HEAD. The first command can be used when you need to bring in a discontinuous history from some other repository (see this blog entry) such as a converted CVS repository. Once you have the index in a state that matches what you need you can create a commit as normal. The read-tree command is not going to be like add - it will not look at anything in the current working folder set. It is doing reset.

提交回复
热议问题