यह उदाहरण मदद कर सकता है किसी को:
नोट "origin
" दूरस्थ "Github पर क्या है"
नोट "mybranch
" मेरी शाखा के लिए मेरे अन्य नाम है के लिए मेरे अन्य नाम है "क्या स्थानीय है" कि मैं कर रहा हूँ github
के साथ समन्वयन - यदि आपने कोई नहीं बनाया है तो आपकी शाखा का नाम 'मास्टर' है। हालांकि, मैं यह दिखाने के लिए अलग-अलग नाम mybranch
का उपयोग कर रहा हूं कि शाखा नाम पैरामीटर का उपयोग कहां किया जाता है।
गीथब पर मेरे रिमोट रेपो वास्तव में क्या हैं?
$ git remote -v
origin https://github.com/flipmcf/Playground.git (fetch)
origin https://github.com/flipmcf/Playground.git (push)
"एक ही कोड के अन्य GitHub भंडार" जोड़ें - हम इस एक कांटा फोन:
$ git fetch
बदलें:
$ git remote add someOtherRepo https://github.com/otherUser/Playground.git
$git remote -v
origin https://github.com/flipmcf/Playground.git (fetch)
origin https://github.com/flipmcf/Playground.git (push)
someOtherRepo https://github.com/otherUser/Playground.git (push)
someOtherRepo https://github.com/otherUser/Playground.git (fetch)
यकीन है कि हमारी स्थानीय रेपो अप टू डेट है बनाना स्थानीय रूप से कुछ सामान। आइए फ़ाइल ./foo/bar कहें।py
$ git status
# On branch mybranch
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: foo/bar.py
समीक्षा मेरी अप्रतिबद्ध परिवर्तन
$ git diff mybranch
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.
स्थानीय रूप से प्रतिबद्ध होते हैं।
$ git commit foo/bar.py -m"I changed stuff"
[myfork 9f31ff7] I changed stuff
1 files changed, 2 insertions(+), 1 deletions(-)
अब, मैं अपने दूरस्थ (GitHub पर) की तुलना में अलग हूँ
$ git status
# On branch mybranch
# Your branch is ahead of 'origin/mybranch' by 1 commit.
#
nothing to commit (working directory clean)
Diff इस दूरदराज के साथ - अपने कांटा: (यह बार-बार git diff master origin
साथ किया जाता है)
$ git diff mybranch 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 diff origin/mybranch origin/master
रिमोट मास्टर शाखा से मेरी स्थानीय सामग्री अलग-अलग कैसे होती है?
$ git diff origin/master
मेरी सामग्री किसी और के कांटे, एक ही रेपो की मास्टर शाखा से अलग कैसे होती है?
$git diff mybranch someOtherRepo/master
[तुलना रिमोट शाखा के साथ स्थानीय Git शाखा?] (Http://stackoverflow.com/questions/1800783/compare-local-git-branch-with-remote-branch) –