まずは「Git」の基本を勉強する
サル先生のGit入門
ローカルでリポジトリを作成
git init
リモートリポジトリをローカルにcloneする
git clone <https url>/<ssh url>
ファイルやディレクトリをステージに登録
git add <filepattern>
ステージに追加されたファイルをコミット
git commit -m <message>
変更されたファイルの一覧を表示
git status
変更されたファイルの差分を確認
git diff --cached <filepattern>
コミットログ
git log
コミットの詳細を確認
git show <commit-hash>
ファイルやディレクトリ名を変更
git mv <oldfilename> <newfilename>
変更の取り消し
・過去のバージョンに戻す
git checkout <commit-hash> -- <filepattern>
※おすすめ
git restore --source=<commit-hash> <filepattern>
・ステージした変更を取り消す
git restore --staged <filepattern>
・ワーク中の変更を取り消す
git restore <filepattern>