Cet exemple pourrait aider quelqu'un :
Note " origin
"est mon alias pour la télécommande "What is on Github".
Note " myfork
"est mon alias pour ma branche "what is local" que je synchronise avec github.
--Vous verrez 'master' comme branche si vous travaillez à partir de la racine du dépôt.
git va définir ces éléments par défaut.
Que sont exactement mes dépôts distants sur github ?
$ git remote -v
origin https://github.com/flipmcf/Playground.git (fetch)
origin https://github.com/flipmcf/Playground.git (push)
s'assurer que notre dépôt local est à jour :
$ git fetch
Changez quelques trucs localement. Disons que le fichier ./foo/bar.py
$ git status
# On branch myfork
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: foo/bar.py
Revoir mes changements non engagés
$ git diff myfork
diff --git a/playground/foo/bar.py b/playground/foo/bar.py
index b4fb1be..516323b 100655
--- a/playground/foo/bar.py
+++ b/playground/foo/bar.py
@@ -1,27 +1,29 @@
- This line is wrong
+ This line is fixed now - yea!
+ And I added this line too.
S'engager localement.
$ git commit foo/bar.py -m"I changed stuff"
[myfork 9f31ff7] I changed stuff
1 files changed, 2 insertions(+), 1 deletions(-)
Maintenant, je suis différent de ma télécommande (sur github)
$ git status
# On branch myfork
# Your branch is ahead of 'origin/myfork' by 1 commit.
#
nothing to commit (working directory clean)
Diffusez ceci à distance - votre fourchette :
$ git diff myfork origin
diff --git a/playground/foo/bar.py b/playground/foo/bar.py
index 516323b..b4fb1be 100655
--- a/playground/foo/bar.py
+++ b/playground/foo/bar.py
@@ -1,27 +1,29 @@
- This line is wrong
+ This line is fixed now - yea!
+ And I added this line too.
(git push pour les appliquer à distance)
Et en plus :
Comment mon fork (révision actuelle sur github) diffère-t-il du master distant sur github ?
$ git diff origin/myfork origin/master
En quoi mon matériel local diffère-t-il du master sur github ?
$ git diff origin/master