指定のフォルダにリポジトリを作成する
リポジトリ作成フォルダを決めそこへ移動
git configコマンドでユーザ名とメールアドレス 登録
まずは最低限ユーザ名とメールアドレスの登録
git config --global user.name sooni git config --global user.email sooni@xxx.xxx
## git configコマンドでユーザ名とメールアドレスを指定します。
git config --global user.name oha-yo
git config --global user.email xxxxx@gmail.com
## 設定内容確認
git config --global --list
## リポジトリを作成する
git init
#これで.gitフォルダができる
#
# この状態で管理するファイル「test.txt」と
# 管理したくない「test.log」
# を配置する
##ステージングエリアに登録する(git add)
## ピリオドは「全てのファイル」を意味する
git add .
## ファイルの変更を確認する
git status
## commitcommandでコミットしてリポジトリへ登録する
## -mはコメント
git commit -m "1st commit"
## コミットを確認する
git log
登録したくないファイルを.gitignoreへ定義する
たまに.gitignoreファイルへ記載しても「管理から外れない」現象に遭遇するかもしれません。そんな時は、追跡一覧を確認してみてください。
追跡一覧
git ls-files
追跡から除外
connect.propertiesファイルを除外したい(–cachedオプションを付ける事でローカル側のファイルは残したまま管理対象から外す事ができます。 –cachedオプション外すとローカル側のファイルも同時に削除します)
git rm --cached connect.properties
[P8Z68] /c/project/postgreImpExp $git ls-files
.gitattributes
.gitignore
.vscode/extensions.json
.vscode/settings.json
connect.properties
export_storedprg.ps1
import_storedprg.ps1
importfiles.txt
new_exportlist_schema.ps1
new_importlist_folder.ps1
template_expfunctiion.sql
template_namelist.sql
template_schema_storedlist.sql
[P8Z68] /c/project/postgreImpExp $
[P8Z68] /c/project/postgreImpExp $git rm --cached connect.properties
rm 'connect.properties'
[P8Z68] /c/project/postgreImpExp $git ls-files
.gitattributes
.gitignore
.vscode/extensions.json
.vscode/settings.json
export_storedprg.ps1
import_storedprg.ps1
importfiles.txt
new_exportlist_schema.ps1
new_importlist_folder.ps1
template_expfunctiion.sql
template_namelist.sql
template_schema_storedlist.sql
[P8Z68] /c/project/postgreImpExp $