0

I would like to ignore the contents of the file to be uncommitted every time I make a new commit to GitHub and i want the file entry in repository

C:\Test\src\app\configs\change.json

How can we ignore the contents of the file to be unchanged?

Used .gitignore to ignore a file to be committed which is not helpful. Read about

--skip-worktree

How can I make git ignore future revisions to a file?

Would like to understand where and how this should be tested locally and on CI

mad hu
  • 15
  • 4
  • The way to tell git to ignore changes to a file that is tracked is using `git update-index --assume-unchanged the-file`. – eftshift0 Nov 14 '22 at 16:28
  • @eftshift0 where do i run this commands? is it in the project directory of the IDE terminal? – mad hu Nov 14 '22 at 16:38
  • In the terminal, inside the directory of the project. – eftshift0 Nov 14 '22 at 16:39
  • Thanks @eftshift0 how about the CI? what if different developer can commit a change to this file? Is there a way i can tell the pipeline(in azure.yml) to ignore the contents of the file? – mad hu Nov 14 '22 at 16:44
  • 2
    Why is `change.json` in the repository if you don't want to track changes the content? – chepner Nov 14 '22 at 17:16
  • I guess you should play a little bit with hooks so that if someone wants to _push_ a change into that file, it gets rejected – eftshift0 Nov 14 '22 at 17:16
  • @chepner because that file is referenced in different files and build is failing – mad hu Nov 14 '22 at 17:21
  • @eftshift0 is there any documentation to refer how to reject a file? i would really want to make this change as we don't have any alternative – mad hu Nov 14 '22 at 17:23
  • 1
    That's a bug to fix, not a bug for Git to *prevent*. – chepner Nov 14 '22 at 17:23

0 Answers0