<Github, Cheatsheet> カンペ

初めてのコミット commitと プッシュ push

まずは、http://github.comに行って、レポジトリrepositoryを作る。
最初にここを押す。
f:id:nekoyukimmm:20171203192901p:plain

で、任意のレポジトリ名を作成。
f:id:nekoyukimmm:20171203192915p:plain

で、ローカルの端末に行って、 git init以降をやる。

>cd ~/hage
>git init
>git add .
>git commit -m 'first commit'
>git remote add origin https://github.com/your_name/hage.git
>git push origin master # type username & password

クローン clone

cd ~/
git clone https://github.com/your_name/hage.git

更新 update

>git add .
>git commit -m "hage revised"
>git push origin master    # origin/masterは省略可

git pushがリジェクトされた時。

>git fetch
>git merge orgin/master
>git push origin master

リモートの更新を取り込む。pull

>git pull <repository> <refspec>   # <repository>, <refspec>は省略可

編集した時。

>git stash save   # 現在の作業を一時的に退避
>git stash list   # 退避した作業の一覧を表示
>git stash pop    # 退避した作業を復元
>git stash drop   # 退避した作業を削除
>git stash clear  # 退避した作業を全て削除

コミットした一覧をみる。& 詳細をみる。

>git log
>git show <commit>

過去のバージョンをゲットする。

1- クローンする。

>git clone https://github.com/XXXXXXXXXXXXXX

2- Githubから任意のバージョンの<SHA>を取得する

3- チェックアウトする。

>git checkout <SHA>

Github内の過去のバージョンを取得する方法 - Qiita

参考。   

www.backlog.jp