狠狠撸

狠狠撸Share a Scribd company logo
WorkShop
server-side engineer
    Daichi Hirata
Purpose
Gitに対しての共通認識
Common understanding for Git


ノウハウの共有
Sharing of knowledge
Agenda
Gitの基礎知識
Basic knowledge


Tips
Basic knowledge
SVN
       Remote Repository
Commit / Checkout

          Working Tree
Git
         Remote Repository
             Pull / Push


                    .git internal
Repository                          Working Tree
                                        stash
                       Index
Component
Repository           Working Tree


             Index
Component
                     git checkout


Repository                             Working Tree
 いつでもリポジトリから以前の状態の
 ワーキングツリーをチェックアウト可能
 You can check out the working tree from the repository

                       Index
 at any time of the previous state.
Component
                           git checkout
ワーキングツリーの変更がイン
デックスへ登録される
   Repository
Change the working tree to the index is
registered.
                                          Working Tree
                                           git add


                             Index
Component
                 git checkout
                インデックスの変更がリポジトリ
                へコミットされる

Repository                          Working Tree
                Index changes are committed to the
                repository.




   git commit                         git add


                     Index
Component
  Repository                           Working Tree
一時的な変更やコミットできない                               git stash
変更を退避させる
Evacuate and commit changes that can
not be a temporary change.
                          Index           stash
Commit
ファイルツリー
File tree

付加情報
Additional information

直前のコミット
Last commit
Commit
ファイルツリー
File tree

付加情報
Additional information

直前のコミット
Last commit
Commit
ファイルツリー
  どれか1つでも異なれば同じファイ
File tree
       ル、同じ内容でも異なるコミット
付加情報 the same ?le with different,
  Commit
     even with the same content but
Additional information
      different if any one.

直前のコミット
Last commit
Commit
ファイルツリー
File tree

付加情報
Additional information

直前のコミット
Last commit
Commit
  任意のコミットから最初のコミット
(initial commit) からそのコミットに
      至る全ての履歴が取得できる

  History all the way to commit from the
(initial commit) can be obtained from the
          ?rst commit commit any.
Branch
あるコミット(そのブランチの最新のコ
ミット)に至る履歴と将来

History and future leading to the (most
recent commit on that branch) commit
there.
Branch
Merge
          master   hotfix


C0   C1     C2
Merge
          master   hotfix


C0   C1     C2      C3
Merge    master


               hotfix


C0   C1   C2    C3
Merge    master


Fast foward    hotfix


C0   C1   C2    C3
Merge
           master

C0   C1     C2        #11

                 C3   C4
Merge
           master

C0   C1     C2        #11

                 C3   C4
Merge
           master

C0   C1     C2        #11

                 C3   C4
Merge
           master

C0   C1     C2        #11

                 C3   C4
Merge
                         master

C0   C1        C2          C5

          C3        C4
                                #11
Rebase
            master

C0   C1      C2        #11

                  C3   C4
Rebase
            master

C0   C1      C2        #11

                  C3   C4
Rebase
                                  master

           master                  #11

C0   C1      C2         C3’          C4’
                    cherry-pick
Rebase              master
C0   C1        C4        C7        #12

          C2        C3        C6

               C5        C8        #13
Rebase              master
C0   C1        C4        C7        #12

          C2        C3        C6

               C5        C8        #13
Rebase                  master
  C0           C1           C4            C7        #12

                     C2              C3        C6

                             C5           C8        #13
$ git rebase --onto master #12 #13
Tips
$git stash
$git bisect
$git commit --amend
$git rebase -i HEAD~x
$git cherry-pick
$git reflog

         tips1: Useful Commands
$git stash [save message]
$git stash list
$git stash pop [stash@{x}]
$git stash apply [stash@{x}]
$git stash drop stash@{x}
$git stash clear

               $ git stash
$git stash [save message]
$git stash list
$git stash pop [stash@{x}]
$git stash apply [stash@{x}]
$git stash drop stash@{x}



               $ git stash
$git stash [save message]
$git stash list
$git stash pop [stash@{x}]
$git stash apply [stash@{x}]
$git stash drop stash@{x}
$git stash clear

               $ git stash
$git stash
$git bisect
$git commit --amend
$git rebase -i HEAD~x
$git cherry-pick
$git reflog

         tips1: Useful Commands
$git bisect start
$git bisect bad
$git bisect good rev
$git bisect next
$git bisect bad/good
$git bisect reset
$git bisect run <test_file>
                  $git bisect
$git stash
$git bisect
$git commit --amend
$git rebase -i HEAD~x
$git cherry-pick
$git reflog
         tips1: Useful Commands
$git stash
$git bisect
$git commit --amend
$git rebase -i HEAD~x
$git cherry-pick
$git reflog
         tips1: Useful Commands
$git stash
$git bisect
$git commit --amend
$git rebase -i HEAD~x
$git cherry-pick
$git reflog
         tips1: Useful Commands
$git stash
$git bisect
$git commit --amend
$git rebase -i HEAD~x
$git cherry-pick
$git reflog
         tips1: Useful Commands
[color]                               [merge]
  diff = auto                             tool = vimdiff
  status = auto                       [core]
  branch = auto                         excludesfile = ~/.gitignore
  ui = auto
[alias]
  co = checkout
  st = status -sb
  wd = diff --word-diff
  tlog = log --graph --pretty=oneline
            --decorate --date=short
            --abbrev-commit --branches
  hist = log --pretty=format:"%C(yellow)%h %C(White)%ad |
                              %C(White)%s%d %C(Red)[%an]"
            --graph --date=short

                                 tips2: Setting
tips2: Setting - gst
tips2: Setting - ignore-changes
tips2: Setting - prompt

More Related Content

骋颈迟社内勉强会