The staging area can be updated via
git reset, is there any case
git checkout (or with many extra parameters) would update the staging area from new HEAD?
UPDATE: It seems git's behavior depends on whether you check out a file or a branch/commit.
git checkout DevBranch.
git checkout file.txtor
git checkout -- file.txt.
git checkout DevBranch -- file.txt.
When you specify a branch or commit to
git checkout, the staging area is indeed updated as well as the working directory. So, for example:
git checkout head~1 myfile.txt
will take the version of myfile.txt that is in head's parent and copy it to both the staging area and the working directory. If you do not specify a commit or branch, i.e.:
git checkout myfile.txt
then the contents of myfile.txt will be copied from the staging area to the working directory; the staging area itself is not changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!Donate Us With