Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

exclude a folder in git fetch upstream

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading