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?

開発環境構築最低限

Last updated at Posted at 2025-04-28

Miniconda

miniconda install

公式

Miniconda 初期化を忘れずに!

if you use WSL (Ubuntu) on Win PC

On the ubuntu terminal

  1. wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh (ここは上記公式サイトに従って適宜変えてね!)
  2. bash ~/Miniconda3-latest-Linux-x86_64.sh
  3. sudo apt install g++ pkg-config
  4. conda config --add channels conda-forge

miniconda useful commands

仮想環境作成

conda create -n your_env_name python=3.x.y

環境の中に入る

conda activate your_env_name

環境から出る

conda deactivate

環境一覧を見る

conda info -e

今いる環境のパッケージ一覧

conda list

今いる環境にパッケージ追加

conda install xxxxx

今いる環境のパッケージ削除

conda uninstall xxxxx

環境を削除する
(conda deactivate してから行う)

conda remove --name your_env_name --all

yml に環境を保存する

conda env export > /Path/to/save/env/dir/your_env_name.yml

or

conda env export -n your_env_name > /Path/to/save/env/dir/your_env_name.yml

【conda】既存環境のyml書き出しから新環境を構築するまでのメモ

or

conda env export --clean > /Path/to/save/env/dir/your_env_name.yml

yml から環境構築

conda env create -f /Path/to/save/env/dir/your_env_name.yml

VSCode

VSCode install

公式

オヌヌメ設定

  1. VSCode 開いて左下の歯車マーク
  2. Settings
  3. 右上の小さいアイコン (Open Settings (JSON))
{
    "security.workspace.trust.untrustedFiles": "open",
    "editor.rulers": [80],
    "editor.renderWhitespace": "all",
    "diffEditor.useInlineViewWhenSpaceIsLimited": false,
}

歯車 → Settings → Commonly Used → Editor Tab Size
4 がいいかなと思う。

必要であれば改行コード設定
歯車 → Settings → Search Settings バーに「eol」と入れる → \n (LF) にする

Git

準備

Git install

まずは既に git が入っているか確認する。

git --version

入っていたら version が表示されるので install する必要はない。
なければ ここ から入手する。

install 出来たか確認する。

git --version

バージョンが表示されたはず。

念のため path が通っているか確認してもいい

参考: Git のインストール 〜Git をMacにインストールしよう〜

Git に自分の情報を登録する

git config --global user.name YOUR_USER_NAME
git config --global user.email YOUR_EMAL@example.com

SSH 接続のための 公開鍵/秘密鍵 を作成する

ssh-keygen -t ed25519 -C "YOUR_EMAL@example.com"

~/.ssh 以下に id_ed25519 (秘密鍵) と id_ed25519.pub (公開鍵) が出来ている。
確認

ls ~/.ssh

公開鍵を GitHub に登録する

cat ~/.ssh/id_ed25519.pub

で terminal に表示されるので copy しておく。
VSCode で開いてコピっても可。

  1. click your icon and select Settings
  2. click the SSH&GPG keys icon on the left side bar
  3. click on the NEW SSH key button
  4. copy and paste the contents of your public key on the field named Key
  5. click on the Add key button

(必要であれば改行コード設定)

git config --global core.autocrlf input

How to use git commands

まずは repository をローカルに取ってくる (clone する)

tips: 扱う repository が増えると messy になるので repo folder を作っておいて、その中に置くといいかも。

  • Repository の page の右上にある Clone というボタンを押して、Clone with SSH を copy する
  • terminal で repo directory に移動して clone する
git clone git@......
  • clone した repository の folder ができているので移動する

よくある実際の作業手順

branch の確認

git branch

master または main って表示されるはず

branch を切って自分の作業をする

git chechout -b new_branch

git branch すると、新しい branch が出来ていて、そこに移動しているのが分かる (先頭に * が付いていて緑になっているのが今いる branch)

~ 作業後 ~

git status

で、どのファイルが modify されたか分かる。

staging する

git add FILE_NAME

ちゃんと staging 出来たか git status して確認する
(余計なファイルを add しちゃったとき: git add を取り消す)

commit を作成する

git commit -m "どういう変更をしたとかのメッセージを書く"

remote に上げる (push する)

git push -u origin new_branch

これで GitHub 上に反映される

他人が作った branch を取り込む

リモート追跡ブランチを最新の状態にする

git fetch

ローカルブランチとリモートブランチすべてを表示する

git branch -a

他人が作った branch を local に持ってくる

git checkout -b other_member_branch origin/other_member_branch

参考: 他メンバーが開発中のリモートブランチをローカルに持ってくる方法

その他のよく使う command

branch を移動する
git checkout 行き先の branch 名

移動後は念のため git branch して移動できてるか確認する

branch の更新を取り込む

目的の branch に移動後、

git pull

tips: conflict する可能性を減らすため、作業前には git pull しておきたい

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?