Git Tutorial — Try Git

Shuma Mizuno
Sep 5, 2018 · 3 min read

学習日: 180905
所要時間: 8時間

Gitとは

Gitとは、プログラムのソースコードなどの変更履歴を記録・追跡するための分散型バージョン管理システム

基本的な操作など

init
gitを始めるための決まり文句
git init

clone
リモートリポジトリをローカルにダウンロード
git clone

fetch
リモートにあってローカルリポジトリにないコミットをダウンロード
リモートブランチの位置を更新
git fetch

pull
リモートの変更を取得後マージ
git pull

status
前回のコミットと変更内容を比較
git status

add
ステージング環境へ追加
git add sample.txt

commit
ローカルコミットを実行
git commit

push
リモートリポジトリへアップロード
git push

tag
タグを付与
git tag v0.1

branch
分岐して記録
git branch

reset
HEADの位置を変更
git reset

revert
HEADの位置を変更
git revert

marge
ブランチの統合
git marge sample

rebase
ブランチの結合
git rebase

任意の位置への移動

ブランチの移動
git checkout sample

ブランチを作成後、チェックアウト
git checkout -b sample

ブランチを別のコミットへ移動
git branch -f sample

1つ上への移動
HEAD^
HEAD~

2つ上への移動
HEAD^^
HEAD~~
HEAD~2

連結させることも可
HEAD~^2~2

他の親への移動
git checkout sample^2

コミットの抽出とHEADへの適用

特定コミット抽出
git cherry-pick sample
git rebase -i

質問事項

特になし

所感

色々調べてたら時間かかりすぎたので反省。
マークダウンで書いてAtomからMediumに投稿するとか
効率あがりそうな方法ないのかな。
無駄な部分ばかりに時間とられて内容うすいし読みにくいし悲しみ。

メモ

・togglを使用して時間管理をしてみる
おすすめ時間管理アプリと時間管理の達人になる 10 のルール
https://navi.dropbox.jp/time-keeping-app

・理解度が足りないのでいつか読む
Git pro
https://git-scm.com/book/ja/v2

なぜ git rebase をやめるべきか — Frasco https://frasco.io/why-you-should-stop-using-git-rebase-535fa30d7e25

Gitチュートリアル 変更を戻す2
https://gist.github.com/satoshin2071/4b9a66e0a7ec18a6fa21

初心者でもわかる!リベースの使い方を解説します
https://liginc.co.jp/web/tool/79390#m1

【git】分かりやすく!mergeは「合流」、rebaseは「付け替え」!
https://nullnote.com/web/git/merge_rebase/

    Shuma Mizuno

    Written by

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade