確認環境
| Env | ver |
|---|---|
| Ubuntu | 20.04.6 LTS |
やり方
ppa:git-core/ppaリポジトリを追加するといける
sudo add-apt-repository ppa:git-core/ppa
sudo apt update -y
sudo apt upgrade -y
sudo apt install git
Git 2.25.1で確認
# マージされてないのは残す
git branch -d $(git branch | grep -vP <PCRE pattern>)
# 強制削除
git branch -D $(git branch | grep -vP <PCRE pattern>)
参考:git-branch - List, create, or delete branches (git-scm.com)
Git 2.25.1で確認。基本-m 1で問題ないと思われる
git revert -m 1 <commit>
Git 2.25.1で確認
# 新しい順
git log --pretty=format:'%H' <commit>..<commit>
# 古い順
git log --pretty=format:'%H' <commit>..<commit> --reverse
VisualStudio 2022でGitの署名コミットをしようとしたらエラーを吐いたのでその対処法
[user]
name = your-name
email = your@example.com
signingkey = XXXXXXXXXXXXX
[commit]
gpgsign = true
下記のgpgはGpg4winにバンドルされているものです
| Env | Ver |
|---|---|
| Visual Studio Community 2022 (64 bit) | Version 17.5.1 |
| Git | 2.40.0.windows.1 |
| gpg | 2.3.4 |
このエラーをコピーしようとするとVisualStudioがクラッシュしたので頑張って写経しました
Git failed with a fatal error.
Git failed with a fatal error.
hint: core.useBuiltinFSMonitor=true is deprecated; please set core.fsmonitor=ture instead
hint: Disable this message with "git config advice.useBuiltinFSMonitorConfig false"
error: cannot spawn gpg: No such file or directory
error: gpg failed wqrite commit object
GitのGlobal Config設定変更で対処する
git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"gpg.exeのパスは環境に応じて書き換えること参考までにWindowsのGlobal Configは%USERPROFILE%\.gitconfigにあるのでファイルを編集して対応する場合は、下記内容を追記することで対応できる
[gpg]
program = "C:\\Program Files (x86)\\GnuPG\\bin\\gpg.exe"