LoginSignup
0
1

簡単なGitコマンドの復習

Last updated at Posted at 2023-09-20

はじめに

業務では主にSVNを使用しているため、Gitを触ることがありません。
なので、勉強がてらここに備忘録として残しておきます。

① git init

$ git init

git initは、現在のディレクトリ内に新しいGitリポジトリが初期化されます。
Gitは、リポジトリの管理に必要なディレクトリやファイル(.gitディレクトリ)を作成します。

② git add

$ git add

git addは、変更したファイルや新しいファイルを、次のコミットで記録するための一時的なリストに追加するコマンドです。つまり、変更を「次にコミットする準備をする」というイメージです。
コミットする前に、どの変更を含めるかを指定するために使います。

③ git commit -m "コメント"

$ git commit -m "コメント"

git commit は、行った変更を「確定」するためのものです。
-m を付けることでコメントを残すことができます。

④ git remote add origin ×××××

$ git remote add origin https://github.com/〇〇/〇〇.git

git remote add origin は、インターネット上にあるサーバーと接続を設定する際に使用されます。

⑤ git push origin master

$ git push origin master

git push origin master は、git commitを実行して確定したファイルやフォルダを、
オンラインにアップロードし、インターネット上で共有することができます。

おわりに

ローカルにあるプロジェクトは今後、Gitで管理していこうと思います。

0
1
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
1