# create a new repository
echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin <repo_url>
git push -u origin main
# push an existing repositor
git remote add origin <repo_url>
git branch -M main
git push -u origin main
remoteの別名ブランチにpush
$ git push origin HEAD:pushしたいブランチ名
git rebase
// masterブランチに移動
$ git checkout master
// リモートのマスターと同期
$ git pull origin master
// 若しくは
$ git fetch origin master
$ git merge origin master
// 作業ブランチに移動
$ git checkout -b hogehoge
// 作業ブランチにてリベース実行(リモートと同期させたローカルのマスターからrebase)
$ git rebase master
git reset HEAD
git reset HEAD file_name
git rev-parse --show-superproject-working-tree --show-toplevel | head -1
# git remote add リポジトリ名 追加するリポジトリ
$ git remote add origin hogehoge
$ git remote set-url origin (new url)
$ git fetch && rebase origin/master
# コミットID確認
git log
# revert
git revert <commit-id>
# push
git push orgin hogehoge
git commit -m "hoge" --date="Sep 9 17:00:30 2021 +0900"
git commit --allow-empty -m "fuga"
git push --delete origin branch_name
# もしくは
git push origin :branch_name
git fetch -p
git reset HEAD
### ファイル名指定
git reset HEAD file_name
git clean -df .
# 使用リポジトリのみ
git config --local core.quotepath false
# お好みでglobalに
git config --global core.quotepath false