Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git再入門編

Naomichi Yamakita
April 23, 2012
4

 Git再入門編

Naomichi Yamakita

April 23, 2012
Tweet

Transcript

  1. ຊࢿྉͷ໾ׂ  ࠓޙ࢝·Δ৽͍͠ϓϩδΣΫτ͸શͯ(JUͰӡӦ͠·͢  طଘϓϩδΣΫτʹؔͯ͠͸Ҡߦ͠·ͤΜʢҰ෦Λআ͘ʣ  ຊࢿྉ͸(JUར༻ऀʢ։ൃऀʣΛର৅ͱ࣮ͨ͠ફ޲͖ͷ಺༰ͱͳͬͯ·͢  ϓϩδΣΫτΛӡ༻͢Δ্Ͱɺඞཁ࠷௿ݶͷػೳΛ঺հ͠·͢ 

    ࢿྉʹهࡌ͞Ε͍ͯΔ಺༰͸࣮֬ʹཧղͯ͠Լ͍͞  ࣭໰͕͋Ε͹ͦͷ৔Ͱڍखͯ͠Լ͍͞  $6*ϕʔεͰઆ໌ΛਐΊ·͢  (6*πʔϧʢ8JOEPXTͷ5PSUPTF(JU౳ʣͷ࢖͍ํʹ͍ͭͯ͸৮Ε·ͤΜ
  2. ৽͍͠όʔδϣϯ؅ཧମ੍(JU  ෼ࢄܕόʔδϣϯ؅ཧγεςϜ  ֤։ൃऀ͕ϩʔΧϧϦϙδτϦΛ࣋ͭ  ։ൃऀ͸ϩʔΧϧϦϙδτϦʹมߋΛίϛοτ͠ɺʮϓογϡʯΛར༻ ͯ͠ωοτϫʔΫ্ͷϦϙδτϦʹߋ৽Λ൓ө͢Δ  ϩʔΧϧϦϙδτϦ͸ϦϞʔτϦϙδτϦ্ͷશͯͷߋ৽ཤྺɺϑΝΠ

    ϧɾσΟϨΫτϦΛϛϥʔϦϯά͢Δ  ίϛοτ࣌ʹεφοϓγϣοτΛอ࣋͢Δʢ4VCWFSTJPO͸ࠩ෼Λอ࣋ʣ  (JU͸෼ࢄܕͰ͋ΔͨΊɺʮதԝαʔόʯͱ͍͏֓೦͸ͳ͍  ͨͩ͠ωοτϫʔΫ্ͷಛఆͷϦϞʔτϦϙδτϦΛதԝαʔό ʢPSJHJOʣͱͯ͠ݟཱͯΔ͜ͱ͸Մೳ
  3. ϦϏδϣϯͷ؅ཧ  (JU͸෼ࢄܕͰ͋ΔͨΊɺϦϏδϣϯ*%͸ଘࡏ͠ͳ͍  ֤։ൃऀͷϦϙδτϦͰߋ৽͕ߦΘΕΔͨΊɺʮ࠷৽ͷϦϏδϣϯʯ͕ ͳ͍  ίϛοτ୯ҐͰCJUͷϋογϡ஋ʢ4)"ʣ͕ৼΒΕΔ $ git

    log --pretty="%h %ai %s" 75e3e7b15a6635bc050d... 2012-04-17 00:37:51 +0900 second commit 697d7ace00a7d0432e7d... 2012-04-17 00:01:58 +0900 first commit ίϛοτ࣌ͷϋογϡ
  4. (JUͷσϝϦοτ  4VCWFSTJPOʹൺ΂ෑډ͕ߴ͍  ૢ࡞͕ଟ͘ɺ࢖༻͢ΔίϚϯυ΋ଟ͍  ίϚϯυϥΠϯ͕جຊɻ(6*πʔϧͰ͸શͯରԠͰ͖ͳ͍  ෼ࢄܕϞσϧΛཧղ͢Δ·Ͱ͕͔͔࣌ؒΔ 

    ϦϏδϣϯ*%ͷ֓೦͕ͳ͍ͨΊɺ࠷৽൛Λ೺Ѳ͠ʹ͍͘  ۭσΟϨΫτϦΛ؅ཧͰ͖ͳ͍  ׳ྫతʹHJUJHOPSFϑΝΠϧΛઃஔ͓ͯ͘͠  ࣗ༝౓͕ߴ͍ͨΊɺνʔϜͰར༻͢Δ৔߹͸ӡ༻ϧʔϧΛܾΊͳ͍ͱ࢖͍ʹ ͍͘
  5. (JUΛಋೖ͢Δཧ༝  4VCWFSTJPOʹଓ͘σϑΝΫτελϯμʔυ  4VCWFSTJPO͔Β(JUʹҠߦͨ͠ϓϩδΣΫτྫ  -JOVY,FSOFM  3VCZPO3BJMT 

    1FSM  "OESPJE  (JU)VCͷଘࡏ  (JUϦϙδτϦͷϗεςΟϯάαʔϏεΛఏڙ  (JUͰఏڙ͞ΕΔ044͕૿͖͍͑ͯͯΔ
  6. (*UͷηοτΞοϓ  8JOEPXT  5PSUPJTF(JU NTZTHJU  IUUQEUYDPKQBSDIJWFT  .BD

     CSFXJOTUBMMHJUʢ·ͨ͸9DPEFͷΠϯετʔϧʣ  -JOVY  ZVNJOTUBMMHJUDPSF
  7.  ։ൃαʔό্Ͱ΋ಉ͡ઃఆΛొ࿥͓ͯ͘͠ (*UͷηοτΞοϓ $ git config user.name "{your_name}" $ git

    config user.email {your_email} $ cat ~/.gitconfig [user] name = {your_name} email = {your_email} [mergetool] keepBackup = true [core] editor = /usr/bin/vim quotepath = false ઃఆϑΝΠϧʹ໊લͱϝʔϧΞυϨε͕ ొ࿥͞Ε͍ͯΔ͜ͱ͕෼͔Δ
  8. ϦϙδτϦ  ϩʔΧϧϦϙδτϦ  ։ൃऀͷϚγϯʹ࡞੒͞ΕͨϩʔΧϧϦϙδτϦɻ։ൃऀ͸ϩʔΧϧϦ ϙδτϦʹର͠ɺBEE΍DPNNJUΛߦ͏  ϦϞʔτϦϙδτϦ  ωοτϫʔΫӽ͠ʹ͋ΔϚγϯ্ʢαʔόͱ͸ݶΒͳ͍ʣͷϦϙδτ

    Ϧɻ։ൃऀ͸ϩʔΧϧϦϙδτϦͷ಺༰ΛQVTIͯ͠ૹ৴ͨ͠ΓɺQVMMͰ ϩʔΧϧͱͷࠩ෼ΛऔಘɾϚʔδ͢Δ  ֓೦తʹ͸4VCWFSTJPOͷDPNNJUɺVQEBUFʹ͍ۙ
  9. ϒϥϯν  ϩʔΧϧϒϥϯν  ϩʔΧϧϦϙδτϦͰ؅ཧ͞ΕΔϒϥϯνɻHJUJOJUͰ৽͍͠Ϧϙδτ ϦΛ࡞੒ͨ͠৔߹ɺσϑΥϧτͷϒϥϯν໊͸NBTUFSͱͳΔɻ NBTUFSʹ͸ৗʹ࠷৽ͷιʔεΛίϛοτ͢Δɻ4VCWFSTJPOͰݴ͏ͱ ͜ΖͷUSVOLͱࣅ͍ͯΔ  ϦϞʔτϒϥϯν

     ϦϞʔτϦϙδτϦ্ͷϒϥϯνɻHJUDMPOF࣌͸NBTUFSϒϥϯν͕ νΣοΫΞ΢τ͞ΕΔ  ϦϞʔττϥοΩϯάϒϥϯνʢ௥੻ϒϥϯνʣ  ݱࡏ༗ޮͳϦϞʔτϒϥϯνͱܨ͕ΓΛ࣋ͭϩʔΧϧϒϥϯν
  10. ΠϯσοΫε  ࣍ͷίϛοτର৅ͱͳΔϑΝΠϧͷҰ࣌ྖҬ  ৽ن࡞੒ͨ͠ϑΝΠϧ͸ඞͣΠϯσοΫεʹొ࿥͕ඞཁ  HJUBEE\ fi MF@OBNF^ 

    ϑΝΠϧΛߋ৽ʢมߋɾ࡟আɾϦωʔϜ౳ʣͨ͠৔߹΋ΠϯσοΫε΁ͷ࠶ ొ࿥͕ඞཁ  ճ໨Ҏ߱͸ίϛοτͱಉ࣌ʹBEEࢦఆ͢Δ͜ͱ΋Մೳ  HJUDPNNJUN\DPNNJU@NFTTBHF^B\ fi MF@OBNF^  ΠϯσοΫεʹొ࿥͞Εͨঢ়ଶΛʮεςʔδʯͱݴ͏
  11. ͦͷଞ  ϫʔΩϯάπϦʔ  ϩʔΧϧϦϙδτϦʹ͓͚Δ࣮ࡍͷ࡞ۀ৔ॴɻ4VCWFSTJPOͷʮϫʔΩϯ άίϐʔʯͱಉ͡  ίϛοτ  ϩʔΧϧϦϙδτϦ΁ͷߋ৽ͷ൓ө

     εφοϓγϣοτ͕࡞੒͞ΕΔλΠϛϯά  ϓογϡ  ϩʔΧϧϦϙδτϦͷ಺༰ΛϦϞʔτϦϙδτϦʹ൓ө͢Δ  ϓϧ  ϦϞʔτϦϙδτϦͷ಺༰ΛϩʔΧϧϦϙδτϦʹ൓ө͢Δ
  12. ϦϙδτϦΛ࡞੒͢ΔHJUJOJU  ৽نϦϙδτϦͷ࡞੒ $ git init gitrep Initialized empty Git

    repository in /Users/naomichi/ gitrep/.git/ $ cd gitrep/ $ ls -la total 0 drwxr-xr-x 3 naomichi staff 102 4 16 23:21:44 2012 . drwxr-xr-x+ 41 naomichi staff 1394 4 16 23:21:44 2012 .. drwxr-xr-x 10 naomichi staff 340 4 16 23:21:44 2012 .git HJU͸ϧʔτσΟϨΫτϦͷΈʹ࡞੒ ͞ΕΔɻHJU͸(JUͷϝλ৘ใΛ؅ཧ͢Δ
  13.  ϦϞʔτϦϙδτϦͷΫϩʔϯΛ࡞੒ ϦϙδτϦΛ࡞੒͢ΔHJUDMPOF $ git clone git@{fqdn}:test gitrep Cloning into

    gitrep... remote: Counting objects: 79, done. remote: Compressing objects: 100% (44/44), done. remote: Total 79 (delta 4), reused 0 (delta 0) Receiving objects: 100% (79/79), 6.09 KiB, done. Resolving deltas: 100% (4/4), done. [naomichi: workgit]$ ls -la gitrep/ total 0 drwxr-xr-x 3 naomichi staff 102 4 16 23:21:44 2012 . drwxr-xr-x+ 41 naomichi staff 1394 4 16 23:21:44 2012 .. drwxr-xr-x 10 naomichi staff 340 4 16 23:21:44 2012 .git HJUDMPOF\SFQPTJUPSZ@QBUI^\VSM^\DSFBUF@EJSFDUPSZ^
  14.  ୯ମϑΝΠϧͷొ࿥ ϑΝΠϧΛΠϯσοΫεʹొ࿥͢ΔHJUBEE $ touch hello $ git add hello

    $ mkdir foo $ touch foo/bar $ touch foo/baz $ git add foo  ෳ਺ϑΝΠϧͷొ࿥  શͯͷϑΝΠϧΛొ࿥ $ git add . εςʔδঢ়ଶ
  15.  ୯ମϑΝΠϧͷίϛοτ ϑΝΠϧΛίϛοτ͢ΔHJUDPNNJU $ touch hello $ git add hello

    $ git commit -m "first commit" [master 697d7ac] first commit 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 hello $ mkdir foo $ touch foo/bar $ touch foo/baz $ git add foo $ git commit -m "first commit" [master 1f615ff] first commit 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 foo/bar create mode 100644 foo/baz  ෳ਺ϑΝΠϧͷίϛοτ HJUNl fi STUDPNNJUzBGPPͰ୅༻Մ (JUͰ͸ίϝϯτೖྗ͕ඞਢ ίϛοτϋογϡͷઌ಄จ
  16.  ϑΝΠϧมߋޙͷ࠶ίϛοτ ϑΝΠϧΛίϛοτ͢ΔHJUDPNNJU $ echo 'this is bar' > foo/bar

    $ echo 'this is baz' > foo/baz $ git add foo/bar $ git commit # On branch master # Your branch is ahead of 'origin/master' by 7 commits. # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: foo/bar # CBSͷΈΠϯσοΫεʹొ CB[͸ίϛοτର৅
  17.  ಛఆͷίϛοτͰมߋ͞ΕͨϑΝΠϧҰཡΛऔಘ ίϛοτͷৄࡉΛ֬ೝ͢ΔHJUTIPX $ touch file_1 file_2 file_3 $ git

    add . $ git commit -m "first commit" $ git log commit dd3ba389a19e85265bd5d382733a86900a56ffe8 ... $ git show --name-only dd3ba389a19e85265bd5d382733a86900a56ffe8 commit dd3ba389a19e85265bd5d382733a86900a56ffe8 Author: {your_name} <{your_email}> Date: Sun Apr 22 01:41:03 2012 +0900 first commit file_1 file_2 file_3 ίϛοτϋογϡ஋ EECBͰίϛοτ͞ΕͨϑΝΠϧͷҰ EECBͷίϛοτ಺༰Λ֬
  18.  ΠϯσοΫεʹొ࿥͞Ε͍ͯΔϑΝΠϧΛϓογϡ͢Δ ϦϞʔτϦϙδτϦ΁ͷ൓өHJUQVTI $ touch hello $ git add .

    $ git commit -m "first commit" [master 4ccbdef] first commit 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 hello $ git push Counting objects: 28, done. Delta compression using up to 4 threads. Compressing objects: 100% (20/20), done. Writing objects: 100% (27/27), 2.14 KiB, done. Total 27 (delta 3), reused 2 (delta 0) To git@{fqdn}:test a22beb4..4ccbdef master -> master QVTI੒ޭ௨
  19.  ଞͷϦϙδτϦͷมߋ఺ΛϩʔΧϧϦϙδτϦʹϚʔδ͢Δ ϦϞʔτϦϙδτϦ͔Βࠩ෼ΛऔಘHJUQVMM $ git pull remote: Counting objects: 5,

    done. remote: Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From {fqdn}:test 4ccbdef..dafbd21 master -> origin/master Updating 4ccbdef..dafbd21 Fast-forward hello | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) QVMM੒ޭ௨஌
  20.  ϫʔΩϯάπϦʔ΍ΠϯσοΫεɺϦϙδτϦͷঢ়ଶΛ෼ྨͯ͠දࣔ͢Δ มߋ͕Ճ͑ΒΕͨϑΝΠϧΛදࣔHJUTUBUVT $ touch a b c d $

    git add b c d $ git commit -m "c,d commited" c d $ echo 'REWRITE' > d $ git status # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: b # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: d # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # a εςʔδঢ়ଶʢίϛοτ଴ͪʣ मਖ਼ঢ়ଶʢεςʔδ଴ ະ௥੻ঢ়
  21.  ࠷৽ίϛοτʢ)&"%ʣ͔ΒͨͲΔ͜ͱ͕Ͱ͖ΔϩάΛදࣔ͢Δ ίϛοτϩάͷදࣔHJUMPH $ git log commit e738db944c0a03b130b2df628213449f6597c08e Author: {your_name}

    <{your_email}> Date: Thu Apr 19 12:30:47 2012 +0900 third commit commit 22a17381b6a514b0eaa511fa0c76edb7ba0bc46b Author: {your_name} <{your_email}> Date: Thu Apr 19 12:16:27 2012 +0900 second commit commit 22a17381b6a514b0eaa511fa0c76edb7ba0bc46b Author: {your_name} <{your_email}> Date: Thu Apr 19 12:16:27 2012 +0900 first commit ... ճ໨ͷίϛοτϩ ճ໨ͷίϛοτϩ ճ໨ͷίϛοτϩ
  22.  ݱࡏͷϒϥϯνΛ֬ೝ͢Δ ϒϥϯνHJUCSBODI $ git branch * master  ৽͍͠ϒϥϯνΛ࡞੒͢Δ

    $ git branch new_branch $ git branch * master new_branch  ৽͍͠ϒϥϯνΛνΣοΫΞ΢τ͢Δ $ git checkout new_branch Switched to branch 'new_branch' $ git branch master * new_branch ʢΞελϦεΫʣ͸ΧϨϯτϒϥϯνΛࣔ͢ ϒϥϯν࡞੒ޙ΋ΧϨϯτϒϥϯν͸NBTUFSͷ·· ΧϨϯτϒϥϯν͕੾ΓସΘΔ
  23.  ৽͍͠ϒϥϯνΛϓογϡ͢Δ ϒϥϯνHJUCSBODI $ git push origin new_branch Counting objects:

    19, done. Delta compression using up to 4 threads. Compressing objects: 100% (14/14), done. Writing objects: 100% (17/17), 1.45 KiB, done. Total 17 (delta 5), reused 1 (delta 0) To git@{fqdn}:test * [new branch] new_branch -> new_branch  ϦϞʔτΛؚΊͨશͯͷϒϥϯνΛ֬ೝ͢Δ $ git branch -a master * new_branch remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/new_branch ϦϞʔτϒϥϯνͷ࡞੒੒ޭ௨஌ ϦϞʔτʹOFX@CSBODI͕࡞੒͞Ε͍ͯΔ͜ͱ͕Θ͔Δ
  24. ࠩ෼ͷൺֱ  HJUEJ ff   ϫʔΩϯάπϦʔͱΠϯσοΫεͷࠩ෼Λൺֱ  εςʔδϯά͞Ε͍ͯͳ͍ϑΝΠϧ͸ൺֱͰ͖ͳ͍ 

    ΠϯσοΫεʹϑΝΠϧ͕ొ࿥͞Εͨঢ়ଶͰɺߋʹಉ͡ϑΝΠϧΛߋ৽ ͨ͠৔߹ʹ࢖͏  ΠϯσοΫεొ࿥ͱίϛοτΛಉ࣌ʹߦ͏৔߹͸͋·Γ࢖Θͳ͍
  25. Ұ෦ͷσΟϨΫτϦͷΈνΣοΫΞ΢τ  (JU͸4VCWFSTJPOͷΑ͏ʹҰ෦ͷσΟϨΫτϦͷΈνΣοΫΞ΢τ͢Δ͜ͱ ͕Ͱ͖ͳ͍  (JU͔Βಋೖ͞Εͨ4QSBTFDIFDLPVUػೳΛ࢖͏  4QBSTFDIFDLPVUFYBNQMFJOHJU $ git

    clone git@{fqdn}:common Cloning into common... remote: Counting objects: 2134, done. remote: Compressing objects: 100% (1173/1173), done. commremote: Total 2134 (delta 906), reused 2125 (delta 903) Receiving objects: 100% (2134/2134), 24.22 MiB | 579 KiB/s, done. Resolving deltas: 100% (906/906), done.) $ cd common/ $ git config core.sparsecheckout true $ echo project/ > .git/info/sparse-checkout $ git read-tree -m -u HEAD ࣍ճҎ߱͸HJUQVMMͰQSPKFDU ͷΈ͕νΣοΫΞ΢τ͞ΕΔ
  26. ಛఆͷϑΝΠϧɾσΟϨΫτϦΛίϛοτର৅֎ʹ͢Δ $ touch a b $ echo 'b' > .gitignore

    $ git add . $ git commit -m "ignore commit" [master 2bfa6b1] ignore commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 .gitignore  ಛఆͷϑΝΠϧΛίϛοτର৅֎ʹ͢Δ ϑΝΠϧC͸ίϛοτ͞Εͳ͍  ಛఆͷσΟϨΫτϦͷ಺༰Λίϛοτର৅֎ͱ͢Δ $ mkdir logs $ touch logs/a logs/b logs/c $ echo 'logs/' > .gitignore $ echo '!.gitignore' >> .gitignore $ touch logs/.gitignore $ git add . $ git commit -m "ignore commit" [master 9a9a128] ignore commit 0 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 a ʮʯ͸൱ఆ MPHTԼ͸ର৅֎ͱ͢Δ͕ɺHJUJHOPSF͸ίϛοτର৅ͱ͢Δ (JU͸ۭσΟϨΫτϦΛ࡟আͯ͠͠·͏ͷͰɺ μϛʔϑΝΠϧΛ࡞੒͓ͯ͘͠
  27. ίϛοτϝʔϧͷݟํ  ϓϩδΣΫτͷ։ൃؔ܎ऀʹϝʔϧ͕௨஌͞ΕΔ This is an automated email from the

    git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "mars". The branch, 1.10 has been updated via f46534818a5432b212e2a24c9d00f706ba7df5f4 (commit) from 3759217a665beabb6f17a81c8e3b26b5c9c02920 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f46534818a5432b212e2a24c9d00f706ba7df5f4 Author: {your_name} <{your_email}> Date: Thu Apr 19 13:39:12 2012 +0900 first commit ----------------------------------------------------------------------- Summary of changes: VERSION | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- mars ϒϥϯν৘ใɺίϛοτϋογϡ৘ใ ίϛοτϩά৘ มߋ͞ΕͨϑΝΠϧͷ৘
  28. ϑΝΠϧ͕Ұํʹ͔͠ଘࡏ͠ͳ͍  ϦϙδτϦ#Ͱϓογϡͨ͠௚ޙͷϨεϙϯε $ git push To git@{fqdn}:test ! [rejected]

    master -> master (non-fast-forward) error: failed to push some refs to 'git@{fqdn}:test' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes (e.g. 'git pull') before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details. OPOGBTUGPSXBSEͱͳΓɺϓογϡʹࣦഊ͢
  29. ϑΝΠϧ͕Ұํʹ͔͠ଘࡏ͠ͳ͍  ରࡦɿϦϞʔτϦϙδτϦͷࠩ෼Λऔಘޙʹϓογϡ͢Δ $ git pull remote: Counting objects: 3,

    done. remote: Compressing objects: 100% (2/2), done. remote: Total 2 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (2/2), done. From {fqdn}:test 05e23a1..ae8a6a6 master -> origin/master Merge made by recursive. 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 d $ git push Counting objects: 14, done. Delta compression using up to 4 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (9/9), 958 bytes, done. Total 9 (delta 2), reused 1 (delta 0) To git@{fqdn}:test ae8a6a6..53fe5ce master -> master QVTI੒ޭ௨஌
  30. ϑΝΠϧͷڝ߹  ϦϙδτϦ#ͰIFMMPΛϓογϡͨ͠௚ޙͷϨεϙϯε $ git push To git@{fqdn}:test ! [rejected]

    master -> master (non-fast-forward) error: failed to push some refs to 'git@{fqdn}:test' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes (e.g. 'git pull') before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details. OPOGBTUGPSXBSEͱͳΓɺϓογϡʹࣦഊ͢
  31. ϑΝΠϧͷڝ߹  ରࡦɿଞͷϦϙδτϦͷมߋΛऔಘ͠ɺࠩ෼ΛνΣοΫ͢Δ $ git fetch $ git diff FETCH_HEAD

    diff --git a/hello b/hello index 10cf535..843c591 100644 --- a/hello +++ b/hello @@ -1 +1 @@ -w-200 +REWRITE B  HJUGFUDI  ଞͷϦϙδτϦͷมߋΛ'&5$)@)&"%ʹ֨ೲ͢Δ  HJUEJ ff '&5$)@)&"%  ϩʔΧϧͱϦϞʔτϦϙδτϦͷࠩ෼Λऔಘ ϑΝΠϧͷࠩ෼͕දࣔ͞Ε
  32. ίϯϑϦΫτϑΝΠϧͷमਖ਼  ϦϙδτϦ#Ͱϓϧͨ͠௚ޙͷϨεϙϯε $ git pull ls remote: Counting objects:

    5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From {fqdn}:test 186584c..22a1738 master -> origin/master Auto-merging hello CONFLICT (content): Merge conflict in hello Automatic merge failed; fix conflicts and then commit the result. ϚʔδதʹίϯϑϦΫτ͕ൃ
  33. ίϯϑϦΫτϑΝΠϧͷमਖ਼  ରࡦɿมߋ͕Ճ͑ΒΕͨϑΝΠϧͷҰཡΛදࣔ͢Δ $ git status # On branch master

    # Your branch and 'origin/master' have diverged, # and have 1 and 1 different commit(s) each, respectively. # # Unmerged paths: # (use "git add/rm <file>..." as appropriate to mark resolution) # # both modified: hello # $ cat hello <<<<<<< HEAD WRITE FROM REP-B ======= WRITE FROM REP-A >>>>>>> 22a17381b6a514b0eaa511fa0c76edb7ba0bc46b Ϛʔδʹࣦഊͨ͠ϑΝΠϧͷҰ