Posts

Избранное сообщение

How to revert changes to only specific file(s)?

How to revert changes to only specific file(s)?  To revert changes to a specific file in Git, use git restore <file> for uncommitted changes or git checkout <commit> -- <file > to pull an older version from history. The correct command depends on whether your changes are saved, staged, or already committed.   Uncommitted Changes Discard local edits in the working directory: git restore <file-path> Unstage a file while keeping your local edits: git restore --staged <file-path> Discard changes in both staged and working directories: git restore <file-path>   Revert a file to how it looked in a past commit: git checkout <commit-hash> -- <file-path> Pull a specific file from another branch: git checkout <branch-name> -- <file-path> To revert a specific file that has already been committed, use git checkout or git restore with a specific commit hash. Overwrite the file and prepare a new commit This method changes ...

Npm i and npm ci , what difference?

Npm i and npm ci , what difference? npm install / npm i - installation which can rewrite package.json and package-lock.json npm ci - clean install which removes node_modules and use package-lock json for installing and do not rewrite them package-lock.json and package.json npm install Installs a package and all its dependencies. Dependencies are driven by npm-shrinkwrap.json and package-lock.json (in that order). without arguments : installs dependencies of a local module. Can install global packages. Will install any missing dependencies in node_modules . It may write to package.json or package-lock.json . When used with an argument ( npm i packagename ) it may write to package.json to add or update the dependency. when used without arguments, ( npm i ) it may write to package-lock.json to lock down the version of some dependencies if they are not already in this file. npm ci Requires at least npm v5.7.1 . Requires package-lock.json or npm-shrinkwrap.json to be present. Thro...