<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://wikiold.home.tartarefr.eu/index.php?action=history&amp;feed=atom&amp;title=VCS%2FGit%2FSyncFork</id>
	<title>VCS/Git/SyncFork - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://wikiold.home.tartarefr.eu/index.php?action=history&amp;feed=atom&amp;title=VCS%2FGit%2FSyncFork"/>
	<link rel="alternate" type="text/html" href="https://wikiold.home.tartarefr.eu/index.php?title=VCS/Git/SyncFork&amp;action=history"/>
	<updated>2026-07-06T23:29:54Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wikiold.home.tartarefr.eu/index.php?title=VCS/Git/SyncFork&amp;diff=2632&amp;oldid=prev</id>
		<title>Didier : Page créée avec « &#039;&#039;&#039;Syncing a fork&#039;&#039;&#039;  == The Setup ==  Before you can sync, you need to add a remote that points to the upstream repository. You may have done this when you originally for... »</title>
		<link rel="alternate" type="text/html" href="https://wikiold.home.tartarefr.eu/index.php?title=VCS/Git/SyncFork&amp;diff=2632&amp;oldid=prev"/>
		<updated>2014-03-23T09:40:35Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec « &amp;#039;&amp;#039;&amp;#039;Syncing a fork&amp;#039;&amp;#039;&amp;#039;  == The Setup ==  Before you can sync, you need to add a remote that points to the upstream repository. You may have done this when you originally for... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Syncing a fork&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== The Setup ==&lt;br /&gt;
&lt;br /&gt;
Before you can sync, you need to add a remote that points to the upstream repository. You may have done this when you originally forked.&lt;br /&gt;
{{Admon/tip|Syncing your fork only updates your local copy of the repository|It does not update your repository on GitHub.}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git remote -v&lt;br /&gt;
# List the current remotes&lt;br /&gt;
# origin  https://github.com/user/repo.git (fetch)&lt;br /&gt;
# origin  https://github.com/user/repo.git (push)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add a new remote&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git remote add upstream https://github.com/octocat/repo.git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git remote -v&lt;br /&gt;
# Verify new remote&lt;br /&gt;
# origin    https://github.com/user/repo.git (fetch)&lt;br /&gt;
# origin    https://github.com/user/repo.git (push)&lt;br /&gt;
# upstream  https://github.com/octocat/repo.git (fetch)&lt;br /&gt;
# upstream  https://github.com/octocat/repo.git (push)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Syncing ==&lt;br /&gt;
&lt;br /&gt;
There are two steps required to sync your repository with the upstream: first you must fetch from the remote, then you must merge the desired branch into your local branch.&lt;br /&gt;
Fetching&lt;br /&gt;
&lt;br /&gt;
Fetching from the remote repository will bring in its branches and their respective commits. These are stored in your local repository under special branches.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git fetch upstream&lt;br /&gt;
# Grab the upstream remote&amp;#039;s branches&lt;br /&gt;
# remote: Counting objects: 75, done.&lt;br /&gt;
# remote: Compressing objects: 100% (53/53), done.&lt;br /&gt;
# remote: Total 62 (delta 27), reused 44 (delta 9)&lt;br /&gt;
# Unpacking objects: 100% (62/62), done.&lt;br /&gt;
# From https://github.com/octocat/repo&lt;br /&gt;
#  * [new branch]      master     -&amp;gt; upstream/master&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have the upstream&amp;#039;s master branch stored in a local branch, upstream/master&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git branch -va&lt;br /&gt;
# List all local and remote-tracking branches&lt;br /&gt;
# * master                  a422352 My local commit&lt;br /&gt;
#   remotes/origin/HEAD     -&amp;gt; origin/master&lt;br /&gt;
#   remotes/origin/master   a422352 My local commit&lt;br /&gt;
#   remotes/upstream/master 5fdff0f Some upstream commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging ==&lt;br /&gt;
&lt;br /&gt;
Now that we have fetched the upstream repository, we want to merge its changes into our local branch. This will bring that branch into sync with the upstream, without losing our local changes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
# Check out our local master branch&lt;br /&gt;
# Switched to branch &amp;#039;master&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git merge upstream/master&lt;br /&gt;
# Merge upstream&amp;#039;s master into our own&lt;br /&gt;
# Updating a422352..5fdff0f&lt;br /&gt;
# Fast-forward&lt;br /&gt;
#  README                    |    9 -------&lt;br /&gt;
#  README.md                 |    7 ++++++&lt;br /&gt;
#  2 files changed, 7 insertions(+), 9 deletions(-)&lt;br /&gt;
#  delete mode 100644 README&lt;br /&gt;
#  create mode 100644 README.md&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your local branch didn&amp;#039;t have any unique commits, git will instead perform a &amp;quot;fast-forward&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git merge upstream/master&lt;br /&gt;
# Updating 34e91da..16c56ad&lt;br /&gt;
# Fast-forward&lt;br /&gt;
#  README.md                 |    5 +++--&lt;br /&gt;
#  1 file changed, 3 insertions(+), 2 deletions(-)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Didier</name></author>
	</entry>
</feed>