staging - Retrieving an old version of a file using Git -
say want retrieve old version of file (filename.html) few commits ago. right in thinking need
git checkout sha -- filename.html (where sha hash of commit want)
but puts file in staging index, , not working directory, right? if run git commit repo update have old file in place, working directory still have newer file (which don't wont more).
i suppose git checkout -- filename.html 2 in sync, best way it? process seems quite drawn out 1 , 1 messy quickly. there way old version of filename.html in working directory without getting 'stuck' in staging index?
thanks.
but puts file in staging index, , not working directory, right?
it put old version both in index and working tree.
if run git commit repo update have old file in place, working directory still have newer file
no, have older version of file.
i suppose git checkout -- filename.html 2 in sync, best way it?
to latest version, have to:
git reset head -- filename.html # remove index git checkout -- filename.html # restore latest
Comments
Post a Comment