tylersDisplayName
tylersDisplayName

Reputation: 1643

Git - How to untrack local files and then push local to remote branch?

On the local side I began tracking all files in my project and removed many of my gitignore restrictions. Due to Git size restrictions and the fact that many of these files are static (images, etc..) I've since decided against pushing all files. No matter what I do with gitignore, when I prepare to commit and push, all of the files are still being tracked and compiled for syncing.

I don't want to remove the files so git rm is out of the question.

Upvotes: 0

Views: 212

Answers (1)

Aasmund Eldhuset
Aasmund Eldhuset

Reputation: 37950

git rm --cached stops tracking the files you give to it without physically deleting them.

Note, though, that this will not shrink your repository's size, since the files will remain in the history. Also, even if you have large files in your repository, they will not cause your repository size to grow over time as long as you don't make changes to them. The time required to push the large files will also be a one-time cost; subsequent pushes (that don't touch the large files) will be fast.

Upvotes: 1

Related Questions