cd [ローカルリポジトリのパス]
git init
git add * // 全部追加
git commit -m "initial commit" // コメント
cd [ローカルリポジトリのパス]
git clone [リモートリポジトリパス]
git clone [リモートリポジトリパス] -b [ブランチ名]
git add [ファイル名] //追加
git add . //すべてのファイル・ディレクトリ
git add *.css //すべてのCSSファイル
git add -n //追加されるファイルを調べる
git add -u //変更されたファイルを追加する
git rm --cached //addしてしまったファイルを除外
git commit -a -m "任意のコメント" //コミット (-aオプションは変更を自動検出してくれる)
git commit -a //変更のあったファイルすべて
git commit -v //変更点を表示してコミット
git pull is shorthand for git fetch followed by git merge FETCH_HEAD. pull = fetch + merge
git pull [options] [<repository> [<refspec>…]]
git pull -f [リモートリポジトリパス] // force強制的
git push [] []
git push origin master //masterを更新
git checkout [branchName]
git checkout -b [branchName] // switch to new branch/新しいブランチを作って、変更
git rm -r --cached .
git add .
git commit --amend // 直前のコミットを取り消す
git reset --soft HEAD~2 // 最新のコミットから2件分をワークディレクトリの内容を保持し取り消す
git reset --hard HEAD~2 // 最新のコミットから2件分のワークディレクトリの内容とコミットを取り消す
git revert -m 1 [mergeコミットのSHA1]
git rebase -i HEAD~2 // HEADから2件のコミットメッセージ
git commit --amend // 修正が完了したら--amendオプションを付けてコミットする。
git rebase --continue // 実行し完了
git reset
git reset -h
ls
git branch
git branch -r // all
git branch -a // all
git mv [-f] [-n] [-k] (source) ... (destination directory)
git mv [元パス] [新パス]
git remote add sync git@your_git_path.git
git fetch sync
cd [ローカルリポジトリのパス]
git svn clone --trunk= --branches=branches --prefix=svn/ [リモートリポジトリパス]
git checkout -b trunk svn/trunk // マージする
git svn fetch
git svn rebase // pull
git svn dcommit // push
クローンしたbranchがNULLので、その他のbranchをチェックアウトする
git branch -a // 全部のブランチを取得
git checkout [branch name]
git checkout -f [branch name] // 強制的
git config --global core.autocrlf input