Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
dotfilesを管理しよう / get-started-with-dotfiles-mana...
Search
yammerjp
January 26, 2023
0
1.5k
dotfilesを管理しよう / get-started-with-dotfiles-management
2023/01/26 CTOA 若手エンジニアコミュニティ LT会
yammerjp
January 26, 2023
Tweet
Share
More Decks by yammerjp
See All by yammerjp
生成AIとの対話から、概念をみつけ、名前をつける / Name it with generative AI
yammerjp
2
2.3k
awkでつくってわかるWebアプリケーション / Web Application Implementation in awk
yammerjp
14
10k
awk basics
yammerjp
1
670
jpro: JSON Processor
yammerjp
0
700
クイズを作ってPHPに親しむ / Make quizzes and get familiar with PHP
yammerjp
2
1.9k
比較演算を壊してみる / php-break-comparison
yammerjp
1
1.3k
切り取り方を工夫してアプリケーションを漸進的に改善する / Incremental improvement by devising application change boundaries
yammerjp
1
2k
社用PCのdotfiles管理 / dotfiles-in-company
yammerjp
1
2.6k
開発チームの新しいエンジニアメンバーがうまくやるには / newcomer-in-development-team
yammerjp
0
2k
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.1k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
34
2.3k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
What's in a price? How to price your products and services
michaelherold
246
12k
Music & Morning Musume
bryan
46
6.9k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Designing for Performance
lara
610
69k
Why You Should Never Use an ORM
jnunemaker
PRO
60
9.6k
BBQ
matthewcrist
89
9.9k
Facilitating Awesome Meetings
lara
57
6.6k
Transcript
dotfiles を管理しよう 2023/01/27 CTO 協会 若手エンジニアコミュニティ LT 会 やんまー @yammerjp
1
自己紹介 やんまー @yammerjp 中山 慶祐 GMO ペパボ株式会社 Web アプリケーションエンジニア 月刊誌
Software Design にて 「開発環境 探求の道」を連載中 https://yammer.jp 2
dotfiles とは 3
.bashrc 4
.zshrc 5
.gitconfig 6
.vimrc 7
dotfiles とは? Unix/Linux における ユーザごとの アプリケーションの設定ファイル .bashrc 、.zshrc 、.vimrc 、.gitconfig
、、、等々 ホームディレクトリに、ドットで始まるファイル名のものが多い 8
dotfiles の例 .gitconfig [user] name = Keisuke Nakayama email =
[email protected]
[include] path = ~/.config/git/config-company [alias] l = log --graph \ --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' \ --abbrev-commit --date=relative sw = !git branch --all --format=\"%(refname:short)\" | fzf | xargs git checkout https://github.com/yammerjp/dotfiles/blob/master/.config/git/config 9
dotfiles の利用例 git l で、ブランチのマージ 状況を視覚的に表示したログ を表示 https://github.com/yammerjp/dotfiles/blob /3b3813ed3f9c8e06006fef14d30df14cb3 228738/.config/git/config#L41
10
dotfiles の利用例 NeoVim 上でショートカット sf を押して、リポジトリ内の 記述を曖昧検索して開く https://github.com/yammerjp/dotfiles/blob /3b3813ed3f9c8e06006fef14d30df14cb3 228738/.config/nvim/init.vim#L121
https://github.com/yammerjp/dotfiles/blob /3b3813ed3f9c8e06006fef14d30df14cb3 228738/.config/nvim/init.vim#L171 11
今日は設定の中身ではなく .. 12
dotfiles の管理 13
14
dotfiles の管理 GitHub にある「dotfiles 」リポジトリ 変更履歴を記録できる 他のマシンへ設定を適用しやすい そのほかにも Public リポジトリであれば、他の人へ共有しやすい
開発環境を構成するツールやシェルスクリプトなどに詳しくなる 例: yammerjp/dotfiles 15
dotfiles 管理をはじめる GitHub にリポジトリを作る* ... https://github.com/new ファイルをコピーしてcommit 、push $ git
clone https://github.com/ あなたのGitHub ユーザ名/dotfiles.git ~/dotfiles $ cd dotfiles $ cp ~/.gitconfig ~/dotfiles/.gitconfig $ git add .gitconfig $ git commit -m "Add .gitconfig" $ git push origin main * 各ファイルの中身を公開して良いかわからなければ、ひとまずPrivate にしておくとよ いだろう 16
ホームディレクトリ のファイルを Git で 管理する シンボリックリンクを用いる Git リポジトリにあるファイル を、ホームディレクトリから 参照可能にする
$ mv ~/.gitconfig ~/.gitconfig.org $ ln -s ~/dotfiles/.gitconfig ~/.gitconfig 17
ln コマンド以外で管理する Git のbare リポジトリを使う $ alias dotfiles='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
Dotfiles: ベア Git リポジトリに保存する最もよい方法 - Atlassian Git Tutorial dotfiles の管理ツールを使う chezmoi, yadm, Dotbot, rcm, GNU Stow, ... 18
dotfiles の管理、はじめてみませんか? 自分好みにカスタマイズして素早く効率的に作業できる 他のマシンでも環境を再現できる ソフトウェアエンジニアの工具箱* ともいえるかもしれない (*)https://scrapbox.io/june29/ 父親の工具箱 19