0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GitHubを使うための最低限のGitコマンド

0
Last updated at Posted at 2026-07-07

で、環境構築が完了していることが前提です。
この記事では、日々の作業について記載しています。

全体の流れ

git status
git add .
git commit -m "変更内容"
git push origin main

解説

git status

git status

として

modified:

untracked files:

が出る場合は、Gitで管理しているファイルに変更がある状態です。必要に応じて git add、git commit を実行します。

nothing to commit

コミットされていない変更はありません。

Your branch is up to date

も表示されていれば、GitHubとも同期されています。

git add .

コミットするファイルを選択する場合は、

git add ファイル名

としますが、カレントディレクトリ配下の変更をすべてコミット対象に追加する場合は、

git add .

とします。通常は何も考えず、git add . で良いです。

git commit

git commit -m "コミットメッセージ"

このコマンドで、今操作しているパソコン内のGitリポジトリに変更履歴を保存します。
コミットメッセージには、変更内容の概要を記述します。

git push

git push origin main

origin はリモートリポジトリの名前、main はブランチ名です。git push origin main は、ローカルの main ブランチを GitHub 上の origin/main に反映します。

パソコンの main -> GitHubの origin/main

にアップロードされるというイメージです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?