![]() Basically, you are telling Git to copy from HEAD to staging area / index, which is how Git reset works. The below command will restore "test.txt" in the index so that it matches the version in HEAD. These changes can be in the form of the update in your working copy or the content in your index (i.e. You would use git restore to revert non-committed changes. Note that it does not update your branch. You can also use it to restore files in index from some other commit. Git restore restores the files in the working tree from index or any other commit you specify. This latter functionality has been extracted into git restore. Apart from switching branches, git checkout can also restore files to a specific commit state. Git restore was introduced when the functionality of git checkout was broken into two separate commands git switch and git restore. Checkout on the other hand, changes the head itself.ĭifference between git checkout and git restore If your HEAD is currently set to the master branch, running git reset 8e3f6r5 will point the master to "9e5e6a4".
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |