以前のリビジョンの文書です
> git init
git commit -m "ファーストコミット"
>git commit --amend
> git checkout [ブランチ名] > git checkout master Switched to branch 'master' Your branch is up to date with 'origin/master'.
git checkout .
>git remote -v origin https://github.com/nekotype/native-background-timer.git (fetch) origin https://github.com/nekotype/native-background-timer.git (push) >git config --get remote.origin.url https://github.com/nekotype/native-background-timer.git
git push -u origin master
git logでコミットidを調べて git reset --hard [コミットid]
> git rev-parse --abbrev-ref HEAD
> git checkout master
//ブランチを作る git branch [new branch] //コミットからブランチを作る git branch [new branch] [commmit] //ブランチを作って切り替える git checkout -b [new branch]
git commit --amend -m "変更後のメッセージ"
git add . //すべてのファイル・ディレクトリ git add *.css //すべてのCSSファイル git add -n //追加されるファイルを調べる git add -u //変更されたファイルを追加する git rm --cached //addしてしまったファイルを除外
// git init 後、初回コミットまで git rm --cached -r . // 全てのファイルを取り消し git rm --cached -r file_name // 特定のファイルを取り消し // 初回コミット以降 git reset HEAD // 全てのファイルを取り消し git reset HEAD file_name // 特定のファイルを取り消し
git rm --cached <filename> ファイル名の大文字小文字をチェックしているので注意
$ git diff --name-only HEAD ef99999
git log --date=short --no-merges --pretty=format:"%cd %s %h (@%cn) " --date=short : 日付をYYYY-MM-DDで表示 --no-merges : マージリクエストを除く --pretty=format : 表示フォーマットを指定できる(%cd:日付、%s:件名、%h:ハッシュ(短縮版)、%cn:コミットユーザ)
$ git log develop..origin/develop --date=short --pretty=format:"%cd %s" 2019-01-01 ... 2019-01-01 ...
git diff 比較ブランチ名 --name-only
$ git log -p [ファイル名]
$ git cat-file -p [commitID]:[ファイル名]
# originの設定 >git remote add origin https://github.com/nekotype/xxxxx.git # push >git push -u origin master # fatal: remote origin already exists.とでてoriginを設定できないときは一旦削除して再登録。 >git remote rm origin
# ファイル名を確認する。(まだコミットしていない場合) > git diff HEAD --name-only # ファイル名を確認する。(特定のコミットにあるファイルの場合はgit logでコミットIDを確認してから) > git diff HEAD <コミットID> --name-only # 復元する。git checkout <commit> -- <FILE_PATH> > git checkout HEAD -- app/src/main/res/drawable/radius.xml