how to git ignore the 'target' and it's 'site' directories and particularly entire 'site' content

6,233 views
Skip to first unread message

pran...@gmail.com

unread,
Mar 4, 2019, 11:46:35 PM3/4/19
to Serenity BDD Users Group
In my Serenity Java testing project, after the tests have been run, the target and it's sub directory 'site' will be filled with tens of files and directories to display reports and screenshots.
Of course, I don't want to commit all those files in to git repository, and even don't want to  see them being tracked.
I did  do this in my .ignore file which is at the top level of the project along with pom.xml as shown 

## Any un needed file any where in the project file structure.

*.class

*.tmp

*.jar

*.html

*.png

*.json

*.csv

*.DS_Store


# any eclipse project file.

.eclipse

.classpath


## All the folders underneath site folder

**/site

site/

site/*


## target folder at the top level of the project structue and paths and contents underneath it

target/

target/*


## target folder at any level of the project structue

**/target

/target 


Picture1..jpg


pran...@gmail.com

unread,
Mar 5, 2019, 10:10:08 PM3/5/19
to Serenity BDD Users Group
This solved the issue. From the page at https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore

First:

git rm -r --cached . 
git add .

Then:

git commit -am "Remove ignored files"


Reply all
Reply to author
Forward
0 new messages