SlideShare uma empresa Scribd logo
1 de 48
Baixar para ler offline
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 file 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
          first 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

Mais conteúdo relacionado

Semelhante a Git社内勉強会

Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messesKatie Sylor-Miller
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with gitDídac Ríos
 
How to Really Get Git
How to Really Get GitHow to Really Get Git
How to Really Get GitSusan Tan
 
Understanding git
Understanding gitUnderstanding git
Understanding gitAvik Das
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierChristoph Matthies
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptuallyseungzzang Kim
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
Git workshop
Git workshopGit workshop
Git workshopRay Toal
 
#5 - Git - Contribuindo com um repositório remoto
#5 - Git - Contribuindo com um repositório remoto#5 - Git - Contribuindo com um repositório remoto
#5 - Git - Contribuindo com um repositório remotoRodrigo Branas
 

Semelhante a Git社内勉強会 (20)

Working with Git
Working with GitWorking with Git
Working with Git
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
M.Mozūras - git
M.Mozūras - gitM.Mozūras - git
M.Mozūras - git
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Git like a pro EDD18 - Full edition
Git like a pro EDD18 - Full editionGit like a pro EDD18 - Full edition
Git like a pro EDD18 - Full edition
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messes
 
Use Git like a pro - condensed
Use Git like a pro - condensedUse Git like a pro - condensed
Use Git like a pro - condensed
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with git
 
How to Really Get Git
How to Really Get GitHow to Really Get Git
How to Really Get Git
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Understanding git
Understanding gitUnderstanding git
Understanding git
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
 
Gittalk
GittalkGittalk
Gittalk
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
simple Git
simple Git simple Git
simple Git
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Git workshop
Git workshopGit workshop
Git workshop
 
T3dd10 git
T3dd10 gitT3dd10 git
T3dd10 git
 
#5 - Git - Contribuindo com um repositório remoto
#5 - Git - Contribuindo com um repositório remoto#5 - Git - Contribuindo com um repositório remoto
#5 - Git - Contribuindo com um repositório remoto
 

Git社内勉強会