Search code examples
githubgithub-pagesgit-clonegit-fork

What is the best practice to get the updates from another repo without making any PR after changes?


I'd like to know how to proceed in GitHub where I could to be able to get the updates from the original repo but prevent opening a PR after each time I push a change made by myself?

The concept I want to apply this is to use a blog template for my GitHub pages. I'd like to get the feature for the future if the contributors would make any but at the same time, I'd like to prevent pushing anything to the original repo as a PR since those commits wouldn't include anything related to making a contribution to the project.


Solution

  • PRs aren't generated automatically, you need to explicitly create them from a branch.

    You can fork a repo and work on it, and when needed, fetch and rebase from the original repo you forked from. As long as you don't explicitly use this repo to create PRs on the original repo, you should be fine.

    EDIT - Adding some details as per the last comment:

    Assume there's a repo called something owned by someone. You can start off by forking it to youruser using the GitHub UI. Then you can clone your fork and work on it:

    git clone https://github.com/youruser/something.git
    

    In order to get the recent changes from the original someone/something repo, you need to set it up as a remote. By convention you'd call this remote your "upstream", but you can really give it any name you choose:

    git remote add upstream https://github.com/someone/something.git
    

    Once you've added it as a remote, you can fetch from it and rebase on top of it:

    git fetch upstream && git rebase upstream/main
    

    (note that using the main branch is just an example. You can of course rebase on top of any branch in the remote repo)