Book Git-Pro

help

git
git help -g

clone

git clone https://github.com/[repo name]
git clone -b [branch name] https://github.com/[repo name]

push

git status
git add [filename]

git config --global user.email "XXXX@XXXX"
git config --global user.name "scottlee"

git commit -m "________"
git push https://github.com/[repo name] [branch name]

checkout or pull

git pull origin master

git checkout master

git checkout master.

reset

git reset --hard

branch

$ git checkout -b iss53
Switched to a new branch "iss53"

This is shorthand for:

$ git branch iss53
$ git checkout iss53

git branch -r  : show all branches

git branch -v (or -vv) 

git pull origin zkdev

git checkout FETCH_HEAD



git blame XXX.cpp

git diff

git status *
git commit -m "update with bower_components handling" honeycomb-ui.yml
git push origin
git add [filename]
git commit
git remote add origin https://____

git remote -v
git push

git checkout .
git clean



$ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.

    nothing to commit, working directory clean


$ git log

    commit 3d43    Date:   Sat Mar 12 16:03:03 2016 -0800  <--
    commit a42f    Date:   Fri Mar 11 19:59:24 2016 -0800
    commit 12bf    Date:   Thu Mar 10 19:19:37 2016 -0800
    commit 0da1    Date:   Thu Mar 10 18:28:49 2016 -0800
    commit 4a42    Date:   Thu Mar 10 18:27:18 2016 -0800
    commit b404    Date:   Thu Mar 10 15:41:57 2016 -0800
    commit c96d    Date:   Mon Mar  7 12:25:14 2016 -0800


$git pull origin master

    remote: Counting objects: 12, done.
    remote: Compressing objects: 100% (8/8), done.
    remote: Total 12 (delta 8), reused 8 (delta 4), pack-reused 0
    Unpacking objects: 100% (12/12), done.
    From https://github.com/XXXX/XXXX
     * branch            master     -> FETCH_HEAD
       3d4320c..d83e3c6  master     -> origin/master
    Updating 3d4320c..d83e3c6
    Fast-forward
    XXXX.js | 18 +++++++++++++-----
     1 file changed, 13 insertions(+), 5 deletions(-)


$ git log

    commit d83e    Date:   Sat Mar 12 17:05:49 2016 -0800 <--
    commit 3ed8    Date:   Sat Mar 12 16:59:27 2016 -0800
    commit 3d43    Date:   Sat Mar 12 16:03:03 2016 -0800 <--
    commit a42f    Date:   Fri Mar 11 19:59:24 2016 -0800
    commit 12bf    Date:   Thu Mar 10 19:19:37 2016 -0800
    commit 0da1    Date:   Thu Mar 10 18:28:49 2016 -0800
    commit 4a42    Date:   Thu Mar 10 18:27:18 2016 -0800
    commit b404    Date:   Thu Mar 10 15:41:57 2016 -0800


$ git checkout d83e

    Note: checking out 'd83e'.

    You are in 'detached HEAD' state. You can look around, make experimental
    changes and commit them, and you can discard any commits you make in this
    state without impacting any branches by performing another checkout.

    If you want to create a new branch to retain commits you create, you may
    do so (now or later) by using -b with the checkout command again. Example:

      git checkout -b new_branch_name

    HEAD is now at d83e3c6... Added all data point to tooltip, remove opacity


$ git checkout 3d43

    Previous HEAD position was d83e3c6... Added all data point to tooltip, remove opacity
    HEAD is now at 3d4320c... Added all data point to tooltip

$ git status

    HEAD detached at 3d4320c
    nothing to commit, working directory clean


$ git checkout master
    Previous HEAD position was 3d4320c... Added all data point to tooltip
    Switched to branch 'master'
    Your branch is up-to-date with 'origin/master'.

$ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.

    nothing to commit, working directory clean