github - ignore git folder without removing from remote repo, and ignore new files -


we have git repository has folder in untrack, that:

  1. the folder still in our remote directory, changes done locally not shown when running "git status"
  2. any new files automatically added folder not tracked well

looking online sort of came conclusion if folder wasn't added gitignore when created, adding it afterwards won't stop tracking folder. folder sort of program generated folder, don't need updated remote repo, still keep there speeds process of things. i've found few solutions online , saw many people ran

git rm -r --cached <your directory> 

which un-track folder, remove remote repo, not want. saw solution involved running

git update-index --assume-unchanged /dir/to/untrack 

this print out "ignoring path dir", if new file created in folder, shows when running "git status". tried editing file 1 directory below 1 set untrack ( i.e. dir/to/untrack/dir2/changedthisfile.txt ) , file still shows when running "git status" too.

any or advice appreciated.
thanks!

first need "assume unchanged" each individual file:

git ls-files -z /dir/to/untrack/ | xargs -0 git update-index --assume-unchanged

then, add .gitignore file /dir/to/untrack/ contains following:

* !/.gitignore 

this should prevent new changes/additions being picked up.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -