worktree
git branch big-feature git worktree ../big-feature big-feature cd ../big-feature
git push origin big-feature
cd ../original_repo git merge big-feature git worktree remove big-feature
the <path>
was really just a path.
gitconfig
[user] name = Yasushi Sakai email = yasushi.accounts@fastmail.com [core] excludesfile = /Users/yasushi/.gitignore_global editor = nvim --cmd 'let g:unception_block_while_host_edits=1' [pull] rebase = true [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = git-lfs filter-process required = true [sequence] editor = interactive-rebase-tool [interactive-rebase-tool] inputMoveDown = j inputMoveUp = k inputMoveSelectionDown = Down inputMoveSelectionUp = Up inputShowCommit = l [format] pretty = format:%C(auto,yellow)%h %C(auto,blue)%>(17)%ah %C(auto,red)% gD% D %C(auto,reset)%s [alias] a = add -A b = branch brm = branch -d s = status -sbu r = rebase -i HEAD~15 l = log n = log -1 HEAD -stat p = pull P = push c = commit cm = commit -m wta = worktree add wtls = worktree list wtrm = worktree remove
- nvim が変なのは、vim の中の terminal で
git commit
なんかをした時に、git をブロック(待ち状態)にしておくため。git rebase -i
もこの設定を見にいくみたい。 interactive-rebase-tool
はコミットの履歴を綺麗にする時に使うもの。矢印上下でコミットの移動だから注意。git rebase -i HEAD~10
で、10 個前の commit から編集可能。(当然サーバーとの齟齬があるなら要--force
)
nvim git client
It’s not that usefull..? I guess if I’m not resolving a huge patch…
gitui
lazygit よりも早くて、小さくて、rust だけど機能が少ないので様子見。
https://github.com/extrawurst/gitui
curl https://raw.githubusercontent.com/extrawurst/gitui/master/vim_style_key_config.ron -o ~/.config/gitui/key_bindings.ron
lazygit
brew install lazygit
os: editPreset: 'nvim' editInTerminal: true gui: showIcons: true
github api
the personal access token (PAT) written below have been invalidated.
list repos
PAT=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 curl -H "Authorization: Bearer $PAT" \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ --url "https://api.github.com/user/repos?per_page=100&affiliation=owner" \ | jq '.[] | .full_name' | sed 's/"//g' >> ~/repos.txt
clone all repos
cd archive cat ~/repos.txt | xargs -I{} git clone git@github.com:{}
delete a repo
PAT=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 REPO=yasushisakai/submo curl -X DELETE \ -H "Authorization: Bearer $PAT" \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ --url "https://api.github.com/repos/$REPO"
bulk remove
use with caution:
#+beginsrc bash :eval never cat repostodelete.txt | sed ’s/“/g’ | awk ’{print “https://api.github.com/repos”$1}’ | xargs curl -X DELETE -H “Authorization: Bearer $PAT” -H “X-Github-Api-Version: 2022-11-28” #+endsrcsdsdfsdfsafsasqabbcc