I have a build script which clones a repo from GitHub and then does some modifications on a few files which are already tracked.
When I type 'git status' it shows these files as modified, but I would like git to think these files are not modified as I don't want to add them to the staging area.
For example, after my build I have modified files that reside in different folders:
config.dat
database/storage.sqlite
code/conf.pyc
I know a manual way telling git to assume these are unchanged by hard-coding with the files names like:
git update-index --assume-unchanged config.dat
git update-index --assume-unchanged database/storage.sqlite
git update-index --assume-unchanged code/conf.pyc
Is there a way to loop through all modified files and perform this operation --assume-unchanged operation on them?
您可以使用ls-files
列出修改后的文件并将其通过管道传递到update-index
git ls-files -m | xargs git update-index --assume-unchanged
使用*表示要忽略的目录中的所有文件。
git update-index --assume-unchanged [file-path]/*
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.