Skip to content

Instantly share code, notes, and snippets.

@hymkor
Last active February 11, 2026 10:55
Show Gist options
  • Select an option

  • Save hymkor/8c44b7eea2d11aeb4db0d05455935e65 to your computer and use it in GitHub Desktop.

Select an option

Save hymkor/8c44b7eea2d11aeb4db0d05455935e65 to your computer and use it in GitHub Desktop.
`jj bookmark move ブックマーク名 -t リビジョン` でブックマーク名の転記が面倒くさいので書いた、自動で直近のものを探して移動させてくれる PowerShell スクリプト(実行前の目視確認あり)
function Step-Exec($cmd) {
While ($true) {
$ans = Read-Host ("`r`n$ {0}`r`n[Y]es: execute, [N]o: skip, [Q]uit ?" -f $cmd)
if ($ans -eq "q" ){
exit 1
}
if ($ans -eq "n" ){
return
}
if ($ans -eq "y" ){
Invoke-Expression $cmd
return
}
}
}
$bookmark=jj log -r "latest(::@ & bookmarks())" --no-graph --template "self.bookmarks()"
$rev = "@-"
if ( $args -ge 1 ){
$rev = $args[0]
}
jj log -r "$bookmark::$rev"
Step-Exec "jj bookmark move $bookmark -t `"$rev`""
Step-Exec "jj git push"
# gist https://gist.github.com/hymkor/8c44b7eea2d11aeb4db0d05455935e65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment