I have a fullstack app and the folder structure as shown below:
my-app
|_____ .git
|_____ backend
|_____ frontend
|_____ .gitignore
As I want to keep all project files in a single repo on GitHub, I init my .git
repo in the root folder (there is no .git
or .gitignore
in the project directories (backend or frontend). However, although I included the target folders and log directory in my backend project, I still see these directories as changes when I execute git status
as shown below:
modified: .gitignore
modified: backend/logs/application.log
modified: backend/target/account-api-0.0.1-SNAPSHOT.jar
modified: backend/target/classes/com/company/common/Constants.class
I tried various combinations by following https://www.atlassian.com/git/tutorials/saving-changes/gitignore. But does not make any sense. Here is related part of my .gitignore
. I am not sure if I should restart command Window or make anything the changes take effect.
target/
logs/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
...
So, how should I update related ignore files and locations when I move .gitignore
from:
from backend folder --> to my-app folder
I also tried to add backend
, or /backend
to some fields, but still no changes. Of course it would be better use a wildcard to cover all the related folders e.g. target. Any idea?