git fork - when does origin get synced from upstream?












1















  1. I create a fork from source (once off)

  2. I clone from the fork (once off)

  3. I make changes in my local workspace, commit, and push to 'origin' which is the fork

  4. I create pull request to owner from 'origin' to 'upstream'

  5. Owner merges my changes to 'upstream'

  6. If I need get latest from 'upstream', I run 'git pull upstream'


(Let's say there is no code conflicts at all)



During the above process, I didn't see the remote 'origin' get synced from remote 'upstream'. Is it a problem? I am new to fork so I cannot understand.
-- Now I realised when I push to 'origin' which is the fork, I am pushing my changes and the changes from 'upstream'. So the origin get synced.



Another question is, how can I do above all operations in one place (git command or github desktop client)? Currently I do some here and do the other there.










share|improve this question
























  • It really depends on how you have your branched configured....
    – Mad Physicist
    Nov 18 '18 at 23:30










  • If/when the owner of upstream merges your pull request, your code makes it into upstream. Often, that will be a merge commit which you will then retrieve when you pull. That merge commit is different than the commit in your repo, but the content of the files is the same (unless there have been other commits unrelated to yours)
    – William Pursell
    Nov 18 '18 at 23:42










  • @WilliamPursell Do you mean, when owner merges my changes, the 'upstream' will get my changes merged, the 'origin' will get synced then? The 'merge' is not one direction update, instead, it is two directions update?
    – rong
    Nov 18 '18 at 23:54
















1















  1. I create a fork from source (once off)

  2. I clone from the fork (once off)

  3. I make changes in my local workspace, commit, and push to 'origin' which is the fork

  4. I create pull request to owner from 'origin' to 'upstream'

  5. Owner merges my changes to 'upstream'

  6. If I need get latest from 'upstream', I run 'git pull upstream'


(Let's say there is no code conflicts at all)



During the above process, I didn't see the remote 'origin' get synced from remote 'upstream'. Is it a problem? I am new to fork so I cannot understand.
-- Now I realised when I push to 'origin' which is the fork, I am pushing my changes and the changes from 'upstream'. So the origin get synced.



Another question is, how can I do above all operations in one place (git command or github desktop client)? Currently I do some here and do the other there.










share|improve this question
























  • It really depends on how you have your branched configured....
    – Mad Physicist
    Nov 18 '18 at 23:30










  • If/when the owner of upstream merges your pull request, your code makes it into upstream. Often, that will be a merge commit which you will then retrieve when you pull. That merge commit is different than the commit in your repo, but the content of the files is the same (unless there have been other commits unrelated to yours)
    – William Pursell
    Nov 18 '18 at 23:42










  • @WilliamPursell Do you mean, when owner merges my changes, the 'upstream' will get my changes merged, the 'origin' will get synced then? The 'merge' is not one direction update, instead, it is two directions update?
    – rong
    Nov 18 '18 at 23:54














1












1








1








  1. I create a fork from source (once off)

  2. I clone from the fork (once off)

  3. I make changes in my local workspace, commit, and push to 'origin' which is the fork

  4. I create pull request to owner from 'origin' to 'upstream'

  5. Owner merges my changes to 'upstream'

  6. If I need get latest from 'upstream', I run 'git pull upstream'


(Let's say there is no code conflicts at all)



During the above process, I didn't see the remote 'origin' get synced from remote 'upstream'. Is it a problem? I am new to fork so I cannot understand.
-- Now I realised when I push to 'origin' which is the fork, I am pushing my changes and the changes from 'upstream'. So the origin get synced.



Another question is, how can I do above all operations in one place (git command or github desktop client)? Currently I do some here and do the other there.










share|improve this question
















  1. I create a fork from source (once off)

  2. I clone from the fork (once off)

  3. I make changes in my local workspace, commit, and push to 'origin' which is the fork

  4. I create pull request to owner from 'origin' to 'upstream'

  5. Owner merges my changes to 'upstream'

  6. If I need get latest from 'upstream', I run 'git pull upstream'


(Let's say there is no code conflicts at all)



During the above process, I didn't see the remote 'origin' get synced from remote 'upstream'. Is it a problem? I am new to fork so I cannot understand.
-- Now I realised when I push to 'origin' which is the fork, I am pushing my changes and the changes from 'upstream'. So the origin get synced.



Another question is, how can I do above all operations in one place (git command or github desktop client)? Currently I do some here and do the other there.







git






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 23 '18 at 5:21







rong

















asked Nov 18 '18 at 23:27









rongrong

213




213












  • It really depends on how you have your branched configured....
    – Mad Physicist
    Nov 18 '18 at 23:30










  • If/when the owner of upstream merges your pull request, your code makes it into upstream. Often, that will be a merge commit which you will then retrieve when you pull. That merge commit is different than the commit in your repo, but the content of the files is the same (unless there have been other commits unrelated to yours)
    – William Pursell
    Nov 18 '18 at 23:42










  • @WilliamPursell Do you mean, when owner merges my changes, the 'upstream' will get my changes merged, the 'origin' will get synced then? The 'merge' is not one direction update, instead, it is two directions update?
    – rong
    Nov 18 '18 at 23:54


















  • It really depends on how you have your branched configured....
    – Mad Physicist
    Nov 18 '18 at 23:30










  • If/when the owner of upstream merges your pull request, your code makes it into upstream. Often, that will be a merge commit which you will then retrieve when you pull. That merge commit is different than the commit in your repo, but the content of the files is the same (unless there have been other commits unrelated to yours)
    – William Pursell
    Nov 18 '18 at 23:42










  • @WilliamPursell Do you mean, when owner merges my changes, the 'upstream' will get my changes merged, the 'origin' will get synced then? The 'merge' is not one direction update, instead, it is two directions update?
    – rong
    Nov 18 '18 at 23:54
















It really depends on how you have your branched configured....
– Mad Physicist
Nov 18 '18 at 23:30




It really depends on how you have your branched configured....
– Mad Physicist
Nov 18 '18 at 23:30












If/when the owner of upstream merges your pull request, your code makes it into upstream. Often, that will be a merge commit which you will then retrieve when you pull. That merge commit is different than the commit in your repo, but the content of the files is the same (unless there have been other commits unrelated to yours)
– William Pursell
Nov 18 '18 at 23:42




If/when the owner of upstream merges your pull request, your code makes it into upstream. Often, that will be a merge commit which you will then retrieve when you pull. That merge commit is different than the commit in your repo, but the content of the files is the same (unless there have been other commits unrelated to yours)
– William Pursell
Nov 18 '18 at 23:42












@WilliamPursell Do you mean, when owner merges my changes, the 'upstream' will get my changes merged, the 'origin' will get synced then? The 'merge' is not one direction update, instead, it is two directions update?
– rong
Nov 18 '18 at 23:54




@WilliamPursell Do you mean, when owner merges my changes, the 'upstream' will get my changes merged, the 'origin' will get synced then? The 'merge' is not one direction update, instead, it is two directions update?
– rong
Nov 18 '18 at 23:54












1 Answer
1






active

oldest

votes


















0















During the above process, I didn't see the remote 'origin' get
synced from remote 'upstream'.




In the workflow you've described, your origin/master branch never
gets synchronized to upstream/master.



When operating against an upstream repository, you will need to
periodically resync your local copy of the repository with the
upstream in order to ensure that you are working with a current
version of the code, which is necessary for your changes to apply
cleanly. This is easiest if you don't make changes on the master
branch in your local copy, but instead always operate on a feature
branch. In this case, your workflow is something like:



# update your local copies of the remote repositories
git remote update

# start working on your code, using the `upstream/master` branch
# as the base.
git checkout -b my-feature upstream/master

[...work happens here...]

# push your changes to your github fork of the upstream repository
git push origin my-feature


At this point, you could submit a pull request from
origin/my-feature to upstream/master. When you next want to make
a change, you would follow the same process, again starting by basing
your work on a current version of the upstream/master branch.



You'll note that in this workflow we generally ignore both your local
master branch and the master branch of your fork on GitHub (aka
origin/master).




Another question is, how can I do above all operations in one place
(git command or github desktop client)? Currently I do some here and
do the other there.




The GitHub folks provide the hub
command line tool that can act as a wrapper for git, providing you
with a single interface for both git and GitHub operations. When
properly installed, you can run git pull-request in order to create
a pull request.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53366483%2fgit-fork-when-does-origin-get-synced-from-upstream%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0















    During the above process, I didn't see the remote 'origin' get
    synced from remote 'upstream'.




    In the workflow you've described, your origin/master branch never
    gets synchronized to upstream/master.



    When operating against an upstream repository, you will need to
    periodically resync your local copy of the repository with the
    upstream in order to ensure that you are working with a current
    version of the code, which is necessary for your changes to apply
    cleanly. This is easiest if you don't make changes on the master
    branch in your local copy, but instead always operate on a feature
    branch. In this case, your workflow is something like:



    # update your local copies of the remote repositories
    git remote update

    # start working on your code, using the `upstream/master` branch
    # as the base.
    git checkout -b my-feature upstream/master

    [...work happens here...]

    # push your changes to your github fork of the upstream repository
    git push origin my-feature


    At this point, you could submit a pull request from
    origin/my-feature to upstream/master. When you next want to make
    a change, you would follow the same process, again starting by basing
    your work on a current version of the upstream/master branch.



    You'll note that in this workflow we generally ignore both your local
    master branch and the master branch of your fork on GitHub (aka
    origin/master).




    Another question is, how can I do above all operations in one place
    (git command or github desktop client)? Currently I do some here and
    do the other there.




    The GitHub folks provide the hub
    command line tool that can act as a wrapper for git, providing you
    with a single interface for both git and GitHub operations. When
    properly installed, you can run git pull-request in order to create
    a pull request.






    share|improve this answer


























      0















      During the above process, I didn't see the remote 'origin' get
      synced from remote 'upstream'.




      In the workflow you've described, your origin/master branch never
      gets synchronized to upstream/master.



      When operating against an upstream repository, you will need to
      periodically resync your local copy of the repository with the
      upstream in order to ensure that you are working with a current
      version of the code, which is necessary for your changes to apply
      cleanly. This is easiest if you don't make changes on the master
      branch in your local copy, but instead always operate on a feature
      branch. In this case, your workflow is something like:



      # update your local copies of the remote repositories
      git remote update

      # start working on your code, using the `upstream/master` branch
      # as the base.
      git checkout -b my-feature upstream/master

      [...work happens here...]

      # push your changes to your github fork of the upstream repository
      git push origin my-feature


      At this point, you could submit a pull request from
      origin/my-feature to upstream/master. When you next want to make
      a change, you would follow the same process, again starting by basing
      your work on a current version of the upstream/master branch.



      You'll note that in this workflow we generally ignore both your local
      master branch and the master branch of your fork on GitHub (aka
      origin/master).




      Another question is, how can I do above all operations in one place
      (git command or github desktop client)? Currently I do some here and
      do the other there.




      The GitHub folks provide the hub
      command line tool that can act as a wrapper for git, providing you
      with a single interface for both git and GitHub operations. When
      properly installed, you can run git pull-request in order to create
      a pull request.






      share|improve this answer
























        0












        0








        0







        During the above process, I didn't see the remote 'origin' get
        synced from remote 'upstream'.




        In the workflow you've described, your origin/master branch never
        gets synchronized to upstream/master.



        When operating against an upstream repository, you will need to
        periodically resync your local copy of the repository with the
        upstream in order to ensure that you are working with a current
        version of the code, which is necessary for your changes to apply
        cleanly. This is easiest if you don't make changes on the master
        branch in your local copy, but instead always operate on a feature
        branch. In this case, your workflow is something like:



        # update your local copies of the remote repositories
        git remote update

        # start working on your code, using the `upstream/master` branch
        # as the base.
        git checkout -b my-feature upstream/master

        [...work happens here...]

        # push your changes to your github fork of the upstream repository
        git push origin my-feature


        At this point, you could submit a pull request from
        origin/my-feature to upstream/master. When you next want to make
        a change, you would follow the same process, again starting by basing
        your work on a current version of the upstream/master branch.



        You'll note that in this workflow we generally ignore both your local
        master branch and the master branch of your fork on GitHub (aka
        origin/master).




        Another question is, how can I do above all operations in one place
        (git command or github desktop client)? Currently I do some here and
        do the other there.




        The GitHub folks provide the hub
        command line tool that can act as a wrapper for git, providing you
        with a single interface for both git and GitHub operations. When
        properly installed, you can run git pull-request in order to create
        a pull request.






        share|improve this answer













        During the above process, I didn't see the remote 'origin' get
        synced from remote 'upstream'.




        In the workflow you've described, your origin/master branch never
        gets synchronized to upstream/master.



        When operating against an upstream repository, you will need to
        periodically resync your local copy of the repository with the
        upstream in order to ensure that you are working with a current
        version of the code, which is necessary for your changes to apply
        cleanly. This is easiest if you don't make changes on the master
        branch in your local copy, but instead always operate on a feature
        branch. In this case, your workflow is something like:



        # update your local copies of the remote repositories
        git remote update

        # start working on your code, using the `upstream/master` branch
        # as the base.
        git checkout -b my-feature upstream/master

        [...work happens here...]

        # push your changes to your github fork of the upstream repository
        git push origin my-feature


        At this point, you could submit a pull request from
        origin/my-feature to upstream/master. When you next want to make
        a change, you would follow the same process, again starting by basing
        your work on a current version of the upstream/master branch.



        You'll note that in this workflow we generally ignore both your local
        master branch and the master branch of your fork on GitHub (aka
        origin/master).




        Another question is, how can I do above all operations in one place
        (git command or github desktop client)? Currently I do some here and
        do the other there.




        The GitHub folks provide the hub
        command line tool that can act as a wrapper for git, providing you
        with a single interface for both git and GitHub operations. When
        properly installed, you can run git pull-request in order to create
        a pull request.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 '18 at 3:43









        larskslarsks

        114k19187195




        114k19187195






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53366483%2fgit-fork-when-does-origin-get-synced-from-upstream%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?