Skip to content

Instantly share code, notes, and snippets.

@nakamura244
Last active January 27, 2016 01:33
Show Gist options
  • Save nakamura244/8d730d6a716135f5eca5 to your computer and use it in GitHub Desktop.
Save nakamura244/8d730d6a716135f5eca5 to your computer and use it in GitHub Desktop.
デザイナーも学ぶgitと使えるコマンド ref: http://qiita.com/nakamura-tsuyoshi/items/84f5f0e019af3f5e50fc
ルートディレクトリ/-.git // gitのメインディレクトリ
| |-.git/config // config設定。最初だけいじる
|- .gitignore // gitで管理しないファイルを指定
|- .gitkeep // 空ディレクトリもgit管理したい場合使う
cd [コピーしたいディレクトリパス]
git clone [リモートリポジトリ名]
git checkout <対象のファイル>
git log <対象のファイルパス> //<対象のファイルパス>の変更履歴をを参照
commit コミット番号
Author: vvvvv <vvvv@example.com>
Date: Wed Sep 9 15:31:24 2015 +0900
コミットメッセージ
...
git checkout <コミット番号> <対象のファイルパス>
git push origin <branch_name>
git clone [リモートリポジトリ名] [コピーしたいディレクトリパス]
管理したいディレクトルートで
git init
git branch <branch_name> //ブランチの作成(作るだけで移動しない)
git checkout -b <branch_name> //ブランチを作成して移動する
git checkout <branch_name> //ブランチの移動
git branch -d <branch_name> //ブランチの削除
git branch -m <branch_name> //現在のブランチ名の変更
git branch // ローカルブランチの一覧
git branch -a //リモートとローカルのブランチの一覧
git branch -r //リモートブランチの一覧
git status
# On branch feature/<branch_name>
nothing to commit (working directory clean)
git status
# On branch feature/<branch_name>
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# aaa nothing added to commit but untracked files present (use "git add" to track)
# On branch feature/<branch_name>
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: test.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
# On branch feature/<branch_name>
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: test.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
git commit -a
テキストエディタ(大体vim)が立ち上がる
test file追加
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch feature/o_205_cf_bank_validation
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: test.txt
#
コマンドモード[esc]に切り替え[:wp]で保存
[:q!]やれば戻る
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment