61
元で始めるgit - gitハンズオン - nato6933 0

Git handson

Embed Size (px)

Citation preview

  • git - git -

    nato6933

    0

  • git

    SVNSubversion

    Webgithub, Bitbucket

    1

  • (Mac/Linux)

    Mac Xcode

    Linux apt-get install git-core

    2

  • (Windows)

    UTF-8Git for Windows http://tmurakam.org/git/

    3

    2ON

  • Windows lessnkf /Git/bin/ less.exenkf.exe

    /etc/inputrc set meta-flag on set input-meta on set output-meta on set convert-meta off set kanji-code utf-8

    4

  • Windows //etc/profile export GIT_PAGER=nkf -s | less

    //User//.gitconfigvista [color]

    ui = auto[i|8n]

    commitencoding=UTF-8

    [core] editor=C:/Program Files(x86)/sakura/sakura.exe - CODE=4

    autocrlf=false

    5

  • git

    branch

    tag

    6

  • master

    feature

    release

    branch

    tag

    7

  • git

    8

  • git git config --global user.name nato6933

    git config --global user.email [email protected] github

    Twitter

    git config --global color.ui auto

    git config --global --list

    9

  • git init

    git add .

    git commit -m

    10

  • 1.

    2. git add .

    3. git commit

    4. 1

    11

  • git init

    .git

    1OK

    12

  • add/commit

    git add foo.txt ( or )

    git commit -m fix bug

    foo.txt

    foo.txt

    foo.txt

    add

    commit foo.txt

    13

  • log

    git log commit

    git log -1 commit

    commit 0f2e96938a2e64aa1ead685614d12468372fe9ac Author: nato6933 Date: Wed Feb 29 13:57:32 2012 +0900 first commit

    commit

    commit

    commit

    commit SHA

    14

  • revert

    git revert HEAD commit log HEADcommit

    git revert commit commitcommit

    15

  • branch git branch feature master masterfeaturebranch

    git branch branch

    git checkout feature feature

    git checkout -b feature master masterfeaturefeature

    git branch -d feature branch

    16

  • 1. git init

    2. vim foo.txt

    3. git add foo.txt

    4. git commit -m first commit

    5. git log

    6. vim foo.txt

    7. git add foo.txt

    8. git commit -m second commit

    9. git log

    10. git revert HEAD

    11. git log

    17

  • git

    18

  • branchmerge

    19

  • branch/merge

    20

  • HTML

    Hello git

    Hello git!!

    git initHTML hoge.html

    hoge.html

    21

  • hoge.html

    git add hoge.html

    git status branch

    git commit -m first commit

    git branch feature master

    git checkout feature

    22

  • master

    feature

    hoge.html

    23

  • hoge.html

    Hello git

    Hello git!! Home

    24

  • git status status

    git add hoge.html

    git commit -m add Home

    git log commit

    25

  • master

    feature

    hoge.html

    hoge.html hoge.html*

    26

  • master

    git checkout master

    git log master branch1

    27

  • merge

    git merge feature featuremastermerge

    git log masterlog2

    28

  • master

    feature

    hoge.html

    hoge.html hoge.html*

    29

  • merge3 git merge feature

    (squash) git merge --squash feature commitmerge

    git cherry-pick commit commitmerge

    30

  • 31

  • branch

    Hello git

    Hello git!! Home Twitter (1) Mail (2)

    1. git checkout -b about master masteraboutbranch

    about

    2. hoge.html(1)

    3. git add hoge.html

    4. git commit -madd Twitter

    5. git branch about2 about

    6. hoge.html(2)

    7. git add hoge.html

    8. git commit -madd Mail 32

  • master

    feature

    about

    hoge.html(1)

    33

    about2

    hoge.html(2)

  • about2hoge.html

    Hello git

    Hello git!! Home Twitter Researh

    1. git checkout about2

    2. hoge.html

    3. git add hoge.html

    4. git commit -madd Research

    5. git log

    34

  • master

    feature

    about

    hoge.html(1)

    35

    about2

    hoge.html(2)

    hoge.html(1)*

  • conflict1. git checkout about

    2. git merge about2

    36

    Auto-merging hoge.html CONFLICT (content): Merge conflict in hoge.html Automatic merge failed; fix conflicts and then commit the result.

    hoge.html

  • hoge.html

    37

    Hello git Hello git!! Home Twitter > about2

  • 38

    Hello git Hello git!! Home Twitter Mail

    Research

    Hello git Hello git!! Home Twitter Mail

  • commit

    add, commit -m git

    39

  • githubgit

    40

  • github

    github

    github githubbranch

    cloneforkpull request githubpull request

    41

  • github

    gitWeb

    OSSgithub

    42

  • githubgithub

    43

  • github

    http://c-loft.com/blog/?p=1541

    ssh

    44

  • githubgithub

    45

  • github

    p github p New Repository p

    p github

    46

  • push

    1. git init

    2. touch README

    3. git add README

    4. git commit -m first commit

    5. git remote add origin [email protected]:nato6933/foo.git originbranch

    6. git push origin master

    47

  • master

    48

    origin

    master

  • githubbranch

    1. git checkout -b feature master

    2. vim hoge.txt

    3. git add .

    4. git commit -madd hoge.txt

    5. git push origin feature

    49

  • master

    50

    origin

    master

    featurefeature

  • cloneforkpullgithub

    51

  • fork

    clone logbranch

    pull branchmerge

    52

  • 2 Ahoge

    53

    1. githubfork 2. fork 3. addcommit 4. push 5. githubpull request

    B

    1. pull requestbranchbranch 2. pull requestBpull 3. 4. pull requestbranchmerge 5. githubpush

    A

  • B

    1. git clone [email protected]:accountB/hoge.git

    2. vim foo.txt

    3. git add .

    4. git commit -medit foo.txt

    5. git push origin master

    54

    githubfork

    githubpull request

  • B

    55

    A

    B

    hoge hoge

    A B

    hoge

    clonepush

    pull request

    fork

    push

    hoge

  • A

    1. git checkout -b pull-request

    2. git pull [email protected]:accountB/hoge.git

    3.

    4. git commit

    5. git checkout master

    6. git merge pull-request

    7. git push origin master

    56

    pull request

  • A

    57

    A

    B

    hoge hoge

    A B

    hoge

    push

    pull request

    hoge

    pull

  • AB

    58

  • 59

    http://room6933.com/mymemo/git/git-index.html

    github http://c-loft.com/blog/?p=1541

    git http://www.textdrop.net/doc/git-cheat-sheet-ja/

    git Travis Swicegood http://www.amazon.co.jp/dp/427406767X/

    Pro Git http://progit.org/book/

  • 60

    Thank you for listening.