Stop GitHub from pulling everything in a directory, but still push to that directory?

Viewed 26

I have a script that locally generates a new report weekly, which I then push to GitHub. I want to continue hosting the archived reports in the /docs directory of my repo to use GitHub Pages. I'd like to push the new report there when the script runs, but not have to pull the archived reports stored there.

Basically, my repo looks like this:

root
├── script
├── functions
└── docs
    ├── archived_report_1
    ├── archived_report_2
    ├── archived_report_3
    ⋮
    └── newest_report

And when I pull to make edits, I'd like to just pull this:

root
├── script
├── functions
└── docs

And still be able to push to the docs directory. How do I make this happen?

Thanks. Still learning here.

1 Answers

As long as your commit only includes files in the docs folder, a git push will push "to the docs directory".

In other words, a push does not involve a specific folder, it only pushes commits, which are snapshots of a full repository.

If you really want to limit those pushes to a docs folder, you would need:

Related