git - Comment mettre à jour ou synchroniser un dépôt fourré sur GitHub

Mots clés : gitgithubsynchronizationrepositoryforkgit

meilleur 3 Réponses git - Comment mettre à jour ou synchroniser un dépôt fourré sur GitHub

vote vote


# Add the remote, call it "upstream":  git remote add upstream  # Fetch all the branches of that remote into remote-tracking branches  git fetch upstream  # Make sure that you're on your master branch:  git checkout master  # Rewrite your master branch so that any commits of yours that # aren't already in upstream/master are replayed on top of that # other branch:  git rebase upstream/master 
git push -f origin master 
vote vote


$ git remote -v # List the current remotes origin (fetch) origin (push)  $ git remote add upstream # Set a new remote  $ git remote -v # Verify new remote origin (fetch) origin (push) upstream (fetch) upstream (push) 
$ git fetch upstream # Grab the upstream remote's branches remote: Counting objects: 75, done. remote: Compressing objects: 100% (53/53), done. remote: Total 62 (delta 27), reused 44 (delta 9) Unpacking objects: 100% (62/62), done. From  * [new branch]      master     -> upstream/master 
$ git branch -va # List all local and remote-tracking branches * master                  a422352 My local commit   remotes/origin/HEAD     -> origin/master   remotes/origin/master   a422352 My local commit   remotes/upstream/master 5fdff0f Some upstream commit 
$ git checkout master # Check out our local master branch Switched to branch 'master'  $ git merge upstream/master # Merge upstream's master into our own Updating a422352..5fdff0f Fast-forward  README                    |    9 -------                 |    7 ++++++  2 files changed, 7 insertions(+), 9 deletions(-)  delete mode 100644 README  create mode 100644 
$ git merge upstream/master Updating 34e91da..16c56ad Fast-forward                 |    5 +++--  1 file changed, 3 insertions(+), 2 deletions(-) 
vote vote


git remote add upstream 
git checkout master git pull upstream master 

Questions similaires