Last active
January 27, 2016 01:33
-
-
Save nakamura244/8d730d6a716135f5eca5 to your computer and use it in GitHub Desktop.
デザイナーも学ぶgitと使えるコマンド ref: http://qiita.com/nakamura-tsuyoshi/items/84f5f0e019af3f5e50fc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ルートディレクトリ/-.git // gitのメインディレクトリ | |
| |-.git/config // config設定。最初だけいじる | |
|- .gitignore // gitで管理しないファイルを指定 | |
|- .gitkeep // 空ディレクトリもgit管理したい場合使う |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd [コピーしたいディレクトリパス] | |
git clone [リモートリポジトリ名] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git checkout <対象のファイル> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log <対象のファイルパス> //<対象のファイルパス>の変更履歴をを参照 | |
commit コミット番号 | |
Author: vvvvv <vvvv@example.com> | |
Date: Wed Sep 9 15:31:24 2015 +0900 | |
コミットメッセージ | |
... | |
git checkout <コミット番号> <対象のファイルパス> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git push origin <branch_name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone [リモートリポジトリ名] [コピーしたいディレクトリパス] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
管理したいディレクトルートで | |
git init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 //リモートブランチの一覧 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git status | |
# On branch feature/<branch_name> | |
nothing to commit (working directory clean) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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