LoginSignup
0
0

More than 1 year has passed since last update.

git メモ

Posted at

gitコマンド

初回のシステムセットアップ

名前とメールをGitに設定

$ git config --global user.name "自分の名前"
$ git config --global user.email your.email@example.com

git coをcheckoutのエイリアスに設定する

$ git config --global alias.co checkout

Gitでパスワードを一定時間保持するように設定する

$ git config --global credential.helper "cache --timeout=86400"

Gitはパスワードを86,400秒(つまり1日)の間保持してくれます

初回のリポジトリセットアップ

新しいリポジトリの初期化

$ cd ~/environment/hello_app    # Just in case you weren't already there
$ git init

プロジェクトの全ファイルをリポジトリに追加(gitignoreを除く)

$ git add -A

コミット

$ git commit -m "Initialize repository"

コミットメッセージの履歴を参照

$ git log

GitHubをリモートoriginに追加してそのリポジトリにpushする

$ git remote add origin https://github.com/<あなたのGitHubアカウント名>/hello_app.git
$ git push -u origin main

-uはset upstream用

ブランチ、編集、コミット、マージ

ブランチ

$ git checkout -b modify-README

$ git branch

(ブランチの状態を確認)

$ git status

変更を一括でコミットする

$ git commit -a -m "Improve the README file"

マージ

$ git checkout master
$ git merge modify-README

(トピックブランチを削除)

$ git branch -d modify-README

プッシュ

$ git push
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