Reputation: 913
I am using Gitlab to deploy my application.
I have few files that needs to be synced to the Gitlab but dont want that to be deployed to the Production.
eg: read.md,notes,snippets.
I know that adding the files to the .gitignore will do the task but it will completely ignore the files.
Are there any other alternative?
Upvotes: 0
Views: 51
Reputation: 22067
There is a way to tell git not to take changes into account specific files :
git update-index --skip-worktree path/to/file
(doc)
You can set it before deploying to production, and unset it for your everyday exchanges on gitlab.
(The question about the respective interests of using --skip-worktree
or --assume-unchanged
has already been answered here, you might want to take a look.)
Upvotes: 1