Skip to main content
added 5 characters in body
Source Link
Benny Code
  • 53.8k
  • 31
  • 243
  • 205

Foreword: Your fork is the "origin" and the repository you forked from is the "upstream".

Let's assume that you cloned already your fork to your computer with a command like this:

git clone [email protected]:your_name/project_name.git
cd project_name

If that is given then you need to continue in this order:

  1. Add the "upstream" to your cloned repository ("origin"):

     git remote add upstream [email protected]:original_author/project_name.git
    
  2. Fetch the commits (and branches) from the "upstream":

     git fetch upstream
    
  3. Switch to the "master" branch of the "origin"your fork (your fork"origin"):

     git checkout master
    
  4. Stash the changes of your "master" branch:

     git stash
    
  5. Merge the changes from the "master" branch of the "upstream" into your the "master" branch of your "origin":

     git merge upstream/master
    
  6. Resolve merge conflicts if any and commit your merge

     git commit -am "Merged from upstream"
    
  7. Push the changes to your fork

     git push
    
  8. Get back your stashed changedchanges (if any)

     git stash pop
    
  9. You're done! Congratulations!

GitHub also provides instructions tofor this topic: Syncing a fork

Foreword: Your fork is the "origin" and the repository you forked from is the "upstream".

Let's assume that you cloned already your fork to your computer with a command like this:

git clone [email protected]:your_name/project_name.git
cd project_name

If that is given then you need to continue in this order:

  1. Add the "upstream" to your cloned repository ("origin"):

     git remote add upstream [email protected]:original_author/project_name.git
    
  2. Fetch the commits (and branches) from the "upstream":

     git fetch upstream
    
  3. Switch to the "master" branch of the "origin" (your fork):

     git checkout master
    
  4. Stash the changes of your "master" branch:

     git stash
    
  5. Merge the changes from the "master" branch of the "upstream" into your the "master" branch of your "origin":

     git merge upstream/master
    
  6. Resolve merge conflicts if any and commit your merge

     git commit -am "Merged from upstream"
    
  7. Push the changes to your fork

     git push
    
  8. Get back your stashed changed (if any)

     git stash pop
    
  9. You're done! Congratulations!

GitHub also provides instructions to this: Syncing a fork

Foreword: Your fork is the "origin" and the repository you forked from is the "upstream".

Let's assume that you cloned already your fork to your computer with a command like this:

git clone [email protected]:your_name/project_name.git
cd project_name

If that is given then you need to continue in this order:

  1. Add the "upstream" to your cloned repository ("origin"):

     git remote add upstream [email protected]:original_author/project_name.git
    
  2. Fetch the commits (and branches) from the "upstream":

     git fetch upstream
    
  3. Switch to the "master" branch of your fork ("origin"):

     git checkout master
    
  4. Stash the changes of your "master" branch:

     git stash
    
  5. Merge the changes from the "master" branch of the "upstream" into your the "master" branch of your "origin":

     git merge upstream/master
    
  6. Resolve merge conflicts if any and commit your merge

     git commit -am "Merged from upstream"
    
  7. Push the changes to your fork

     git push
    
  8. Get back your stashed changes (if any)

     git stash pop
    
  9. You're done! Congratulations!

GitHub also provides instructions for this topic: Syncing a fork

format code blocks
Source Link
Emil Laine
  • 42.4k
  • 11
  • 105
  • 158

Foreword: Your fork is the "origin" and the repository you forked from is the "upstream".

Let's assume that you cloned already your fork to your computer with a command like this:

git clone [email protected]:your_name/project_name.git
cd project_name

If that is given then you need to continue in this order:

  1. Add the "upstream" to your cloned repository ("origin"):

    git remote add upstream [email protected]:original_author/project_name.git

     git remote add upstream [email protected]:original_author/project_name.git
    
  2. Fetch the commits (and branches) from the "upstream":

    git fetch upstream

     git fetch upstream
    
  3. Switch to the "master" branch of the "origin" (your fork):

    git checkout master

     git checkout master
    
  4. Stash the changes of your "master" branch:

    git stash

     git stash
    
  5. Merge the changes from the "master" branch of the "upstream" into your the "master" branch of your "origin":

    git merge upstream/master

     git merge upstream/master
    
  6. Resolve merge conflicts if any and commit your merge

    git commit -am "Merged from upstream"

     git commit -am "Merged from upstream"
    
  7. Push the changes to your fork

    git push

     git push
    
  8. Get back your stashed changed (if any)

    git stash pop

     git stash pop
    
  9. You're done! Congratulations!

GitHub also provides instructions to this: Syncing a fork

Foreword: Your fork is the "origin" and the repository you forked from is the "upstream".

Let's assume that you cloned already your fork to your computer with a command like this:

git clone [email protected]:your_name/project_name.git
cd project_name

If that is given then you need to continue in this order:

  1. Add the "upstream" to your cloned repository ("origin"):

    git remote add upstream [email protected]:original_author/project_name.git

  2. Fetch the commits (and branches) from the "upstream":

    git fetch upstream

  3. Switch to the "master" branch of the "origin" (your fork):

    git checkout master

  4. Stash the changes of your "master" branch:

    git stash

  5. Merge the changes from the "master" branch of the "upstream" into your the "master" branch of your "origin":

    git merge upstream/master

  6. Resolve merge conflicts if any and commit your merge

    git commit -am "Merged from upstream"

  7. Push the changes to your fork

    git push

  8. Get back your stashed changed (if any)

    git stash pop

  9. You're done! Congratulations!

GitHub also provides instructions to this: Syncing a fork

Foreword: Your fork is the "origin" and the repository you forked from is the "upstream".

Let's assume that you cloned already your fork to your computer with a command like this:

git clone [email protected]:your_name/project_name.git
cd project_name

If that is given then you need to continue in this order:

  1. Add the "upstream" to your cloned repository ("origin"):

     git remote add upstream [email protected]:original_author/project_name.git
    
  2. Fetch the commits (and branches) from the "upstream":

     git fetch upstream
    
  3. Switch to the "master" branch of the "origin" (your fork):

     git checkout master
    
  4. Stash the changes of your "master" branch:

     git stash
    
  5. Merge the changes from the "master" branch of the "upstream" into your the "master" branch of your "origin":

     git merge upstream/master
    
  6. Resolve merge conflicts if any and commit your merge

     git commit -am "Merged from upstream"
    
  7. Push the changes to your fork

     git push
    
  8. Get back your stashed changed (if any)

     git stash pop
    
  9. You're done! Congratulations!

GitHub also provides instructions to this: Syncing a fork

Source Link
Benny Code
  • 53.8k
  • 31
  • 243
  • 205

Foreword: Your fork is the "origin" and the repository you forked from is the "upstream".

Let's assume that you cloned already your fork to your computer with a command like this:

git clone [email protected]:your_name/project_name.git
cd project_name

If that is given then you need to continue in this order:

  1. Add the "upstream" to your cloned repository ("origin"):

    git remote add upstream [email protected]:original_author/project_name.git

  2. Fetch the commits (and branches) from the "upstream":

    git fetch upstream

  3. Switch to the "master" branch of the "origin" (your fork):

    git checkout master

  4. Stash the changes of your "master" branch:

    git stash

  5. Merge the changes from the "master" branch of the "upstream" into your the "master" branch of your "origin":

    git merge upstream/master

  6. Resolve merge conflicts if any and commit your merge

    git commit -am "Merged from upstream"

  7. Push the changes to your fork

    git push

  8. Get back your stashed changed (if any)

    git stash pop

  9. You're done! Congratulations!

GitHub also provides instructions to this: Syncing a fork