gitのコマンドまとめ
2020/04/24

Contents
master以外のブランチをclone
1 |
git clone https::/GITのURL -b branch_name |
.gitignoreの反映
キャッシュの削除をしないと反映しない。
1 |
git rm -r --cached . |
競合の削除
ローカルでファイルを変更した後に、コミットせずにgit pullしようとすると下記のエラーが出ました。
1 |
commit your changes or stash them before you can merge. |
1 |
git stash |
現在のブランチの確認
1 |
$ git branch --contains=HEAD |
リモートURLの変更
1 |
$ git remote set-url origin {new url} |
リモートブランチの更新が見えない
vscodeからリモートブランチをcheckoutしようとしたが、ブランチが見つからなかったので下記を実施。
1 |
$ git fetch --all |
直前のコミットメッセージを変更する
1 2 3 |
$ git add -A $ git commit -m "間違えたメッセージ" $ git commit --amend -m "正しいメッセージ |