简体   繁体   中英

Git keep file in repository but stop tracking local changes

I have an app.properties file with dummy values that I have committed and pushed to my Git repository. I would now like to tell Git to:

  1. Stop tracking changes to my local app.properties file and
  2. Keep the initial app.properties file that was committed to my repository intact.

I have already added *.properties to my .git/info/exclude file, but git status is still detecting any changes that I make to my local app.properties file.

您可以说使用--assume-unchanged命令将文件视为未更改的git

git update-index --assume-unchanged app.properties

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM