0

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?

mightyteja
  • 825
  • 1
  • 14
  • 38

1 Answers1

1

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.)

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61