Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Select Topic Area

Question

Body

I've been attempting to backup my unity project using github desktop, but when excluding certain folders in the .gitignore file, they arent excluded.
I've been told that apparently including/excluding specific folders after a commit has already been made doesnt really do anything. Unfortunately, when making a repository a commit is made automatically regardless. Is there some way I can circumvent this or should I use something other than github desktop?
Any help would be appreciated!

You must be logged in to vote

Replies: 1 comment · 2 replies

Comment options

Yeah, that happens pretty often. Once a file has already been tracked in your first commit, updating your .gitignore later won’t actually stop Git from tracking it. That’s why it still shows up even after you add it to the ignore list.

What you can do is basically “untrack” those files once. Just open the terminal in your repo and run:

git rm -r --cached .
git add .
git commit -m "Updated .gitignore"

That’ll make Git forget the files that should be ignored, without deleting them from your project.

You can keep using GitHub Desktop — this isn’t a problem with it, just how Git works in general. Happens to most of us at least once

You must be logged in to vote
2 replies
@ToastWasToasty
Comment options

Thank you for the help! this has been given me a headache for a few days lmao
Is it possible to make it untrack specific folders? And if so would it also then untrack the subsequent files and folders contained within that folder?

@Moinkhan-cmd
Comment options

Yeah, absolutely! You can untrack just a specific folder instead of everything.
For example, if you want to untrack the node_modules folder, you can run:

git rm -r --cached node_modules

That’ll stop Git from tracking that folder and everything inside it (subfolders and files too), as long as it’s listed in your .gitignore.
After that, just do a quick git add . and git commit -m "Untracked node_modules folder" to save the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Repositories The core of version-controlled code storage Question Ask and answer questions about GitHub features and usage
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.