よく使うやつ
git add .
git commit -m" コメント "
git push リポジトリ名
初めてpush時、リモートリポ追加
git init
git add .
git commit -m "Initial commit: next_purchase API + virtualenv + requirements"
git branch -M main
git remote add origin <リポジトリURL>
git push -u origin main
リモートリポ追加コマンドしてないと..
cannnot find origin main
プルリク マージ
gh pr create --base main --head ブランチ名 --title "Add integration tests" --body "結合テスト追加"
gh pr merge ブランチ名 --merge --admin
git checkout main
git pull origin main
merge取り消す
git revert <コミットID>
いらんファイルコミットしちゃった
git reset --soft HEAD~1
git reset <不要ファイル>
必要ファイルのみでコミットし直す
git commit -m "必要なファイルだけコミット"
いらんファイルaddした
git reset <不要ファイル>
いらんファイルpushした
git rm <不要ファイル>
git commit -m "Remove unwanted file"
git push origin <ブランチ名>
ブランチ名間違え、間違いブランチにいる
git brach
ブランチ名間違え、間違いブランチにいない
git brach
git checkout 別ブランチ
git branch -d 間違えたブランチ名
git checkout -b 正しいブランチ名
git statusエラー
リモートがローカルに反映されてない
Your branch is ahead of 'origin/main' → git push
リモートを取り込まなきゃいけない + pushが拒否された
Your branch is behind 'origin/main' → git pull origin main
Untracked files:にadd したいファイルがあった
git add ファイル名
git checkout -- ファイル名 使いどき
addしてないファイルを元に戻したい
ファイルを間違えて編集しちゃった
新しい関数作ったけど、ファイルadd予定 ない
ファイル編集したけど、その編集を元に戻したい