Search code examples
githubrepositoryskip

How to skip some files while committing in GitHub?


I have some configuration files in my solution. For development purpose I've done some configuration changes in those files. But i don't want those files to be get committed / pushed in my develop branch in GitHub repository. Is there any way I can add file names which I want to skip at the time of commit and push?


Solution

  • You simply can mark it as to ignore local changes (not with .gitignore since it is already tracked), using git update-index --assume-unchanged

    git update-index --assume-unchanged -- my-config-file
    

    (You also have git update-index --skip-worktree: see the difference here)

    A git pull would reset that flag.
    To remove said flag manually: git update-index --no-assume-unchanged -- my-config-file.