Home > Mobile >  exclude a folder in git fetch upstream
exclude a folder in git fetch upstream

Time:05-31

I want to upstream my fork repo with the forked-from repo but, I don't want to fetch a specific folder of their repo because I have my own customized folder in my repo.

except that I want all their other updates.

Actually, I made a pull request to their repo and made that folder, my PL has been merged and during the time they updated and changed some options on it. all I want is to use my own customization on that folder, with their updates on other sides.

my fork repo and their repo the folder I want to exclude is snippets/frameworks/django/

CodePudding user response:

The idiomatic way to accomplish this is not by excluding their folder updates, but simply include your local changes, i.e. in form of a local-only branch. That way, you can benefit from all versioning/change tracking goodness.

A sketch for a rebase-based flow for local-only changes:

  1. git clone https://github.com/rafamadriz/friendly-snippets
  2. git checkout -b my-changes
  3. perform your local changes
  4. git add snippets/frameworks/django
  5. git commit -m "django: change foo & bar"

You might even want to push your branch to your forked repo.

If upstream now receives updates you are interested in, simply:

  1. git fetch origin
  2. git rebase origin/main (while still on branch my-changes)

If no conflicts happened, now your changes are performed against the latest upstream state.

If conflicts are more common, you might be interested in tracking the resolution explicitly, an switch to a merge-based integration flow.

  • Related