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?

Gitのブランチ名作成を爆速にする!Issue情報をコピーするブックマークレット集

0
Posted at

はじめに

開発中、Gitのブランチ名を作成する際に「Issue番号とタイトルを毎回手動でコピーして整形する」という作業を面倒に感じたことはありませんか?
今回は、ブラウザからワンクリックでIssue情報を特定の形式(#Issue番号_タイトル)に整形してクリップボードにコピーできる、便利なブックマークレット集を紹介します。

使い方

  1. ブラウザのブックマークを作成し、名前を適宜(「Get Issue」など)設定します。
  2. URL欄に、以下のJavaScriptコードを貼り付けて保存します。
  3. 対象のIssue画面(GitHubやRedmine)を開いた状態で、そのブックマークをクリックしてください。

Redmine用

チケット番号とタイトルを取得し、スペースを _ に、 /. に置換してコピーします。
スペースを _ に、 /. に置換してコピーします。
#123_タイトル の形式でコピーします。

 javascript:(function(){const id=document.querySelector('#content h2')?.innerText.match(/#(\d+)/)?.,title=document.querySelector('.subject h3')?.innerText;if(id&&title)navigator.clipboard.writeText("#"+id+"_"+title.replace(/\s+/g,'_').replace(/\//g,'.'));})();

GitHub用

Issue番号とタイトルを取得し、
#123_タイトル の形式でコピーします。

javascript:(function(){const id=document.querySelector('.gh-header-number')?.innerText.replace('#',''),title=document.querySelector('.js-issue-title')?.innerText;if(id&&title)navigator.clipboard.writeText("#"+id+"_"+title.trim());})();

リポジトリ

最新のコードや詳細については、以下のGitHubリポジトリをご確認ください。
gitのブランチ名作成用のbookmarklet

終わりに

「入力の堅牢性」や「操作性」を重視する私にとって、こうした小さな自動化の積み重ねが開発効率を大きく変えると信じています。
ブランチ名作成の手間を減らし、より本質的なコーディングの時間に充てていきましょう!

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?