0

I have some existing code but now want to push this to GIT so I followed some steps and it states

cd <localdir> git init git add . git commit -m 'message' git remote add origin <url> git push -u origin main 

I do jus that but I want to omit the obj and debug folders for example however when I try to this my pending committed files do not change.

I am little confused as to why its not respecting my ignore file? I must be doing something silly but not sure what

enter image description here

1
  • 1
    Your gitignore file does not contain an entry for debug. bin and obj should already be picked up. Note that gitignore does not ignore tracked files. You did git add ., so all files are tracked. You can only ignore untracked files Commented May 8, 2024 at 14:34

2 Answers 2

1

You have to append a / to folders to ignore:

bin/ obj/ debug/ packages/ 
Sign up to request clarification or add additional context in comments.

2 Comments

The problem is that the files are already tracked. You cannot ignore tracked files
To untrack them you have to issue git rm --cached <FILES> and a commit.
0

You need to exclude all files and directories inside obj and debug folder by adding "/**"

obj/** debug/** 

2 Comments

The trailing slash is enough.
@AntonioPetricca /** also would work on untracked files.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.