0

in git large file system, I have untracked some folder, say folder1, say it contains very huge trunks (a lot large of folders) of things... I have previously untracked it to avoid errors (since I even after i just git pull and git push, it would say it has changed and push tons of things online which is complete waste of resources). ok now, I have added something in folder 1 locally, say:

folder1/important_update1

I want to only commit folder1/important_update1 but nothing else... What should I do?

should i just do:

git commmit folder1/important_update1
git push
Vacassal Alsk
  • 391
  • 1
  • 6
  • 19
  • 1
    I would suggest adding things that are in folder1 to git ignore file that you don't want to be tracked. [https://git-scm.com/docs/gitignore](https://git-scm.com/docs/gitignore) Please have a look at this for files that are still being tracked after being added to git ignore config file - [http://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore](http://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore) – SagaciousLearner Oct 10 '16 at 01:30
  • There are too many things in folder1, hundreds.. thousands of folders... I am using git LFS... – Vacassal Alsk Oct 10 '16 at 01:35

1 Answers1

1

You can add the file using git add -f folder1/important_update1 and commit your changes afterwards. In the future your changes to that file will not be ignored.

You could also ignore the contents of folder1 and exclude important_update1 from that using these entries in your .gitignore:

folder1/*
!folder1/important_update1

The first line is important as you can not exclude files if their parent directory has been ignored before (so this wouldn't work if the first line were just folder1).

The latter method might be useful if you want to "unignore" all files matching a specific pattern, e.g. use !folder1/important_update* to avoid ignoring all files and folders starting with important_update within folder1.

lucash
  • 1,982
  • 17
  • 25