I was trying to ignore the changes on composer.phar
and composer.phar
files from the staging area (local host). So I followed this post answer and did:
git rm --cached composer.lock
git rm --cached composer.phar
and added:
/composer.lock
/composer.phar
to .gitignore
file. And all seemed to go as expected, as those files were still there, but they weren't followed.
But now, when I try to pull the changes from the server, these files are removed. I don't what to remove those files, just don't follow them. How could I come back or resolve this issue?
Well yes, you deleted the file from the index. You first need to get it back. You can either revert the commit which did that with
git revert sha_key_of_commit_that_deleted_it
or if you are ok about changing history you just reset your branch to the point before the change with
git reset sha_key_of_the_commit_where_sky_was_blue
Then, what you want to do is this to stop the file from receiving any further changes but keeping it the way it is:
git update-index --assume-unchanged /composer.lock
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.