惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
L
LangChain Blog
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
A
About on SuperTechFans
J
Java Code Geeks
量子位
博客园 - 三生石上(FineUI控件)
博客园 - Franky
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

Max Böck | Notes

18 Jan 2024 - 14:25 12 Jan 2024 - 16:23 11 Jan 2024 - 18:11 11 Jan 2024 - 16:51 04 Jan 2023 - 13:19 22 Nov 2021 - 20:55 15 Oct 2021 - 21:12 03 Sep 2021 - 16:56 03 Sep 2021 - 16:52 08 Jul 2021 - 10:04 07 Jul 2021 - 09:04 06 Jul 2021 - 20:03 07 Apr 2021 - 12:03 07 Nov 2020 - 20:11 27 Apr 2020 - 15:27 25 Apr 2020 - 19:28 08 Feb 2020 - 16:13 26 Dec 2019 - 19:47 20 Dec 2019 - 15:23 14 Dec 2019 - 14:50 10 Dec 2019 - 11:32 22 Nov 2019 - 15:36 21 Nov 2019 - 16:37 11 Nov 2019 - 13:10 29 Sep 2019 - 14:30 12 Aug 2019 - 10:13 08 Aug 2019 - 12:46 04 Aug 2019 - 02:00 09 Jun 2019 - 02:00 01 Jun 2019 - 02:00
15 May 2019 - 02:00
Max Böck · 2019-05-15 · via Max Böck | Notes

We use gitlab issues at work, which supports tagging commit messages with an issue number, to make that commit appear in the issue thread. I often forget to tag my messages though, and then remember a second after committing.

So I wrote a little helper function as a custom git command:

#!/bin/sh

OLD_MSG=$(git log --format=%B -n1)
git commit --amend -m "$OLD_MSG, #$1"

It’s just a simple shell script that fetches the last commit message and appends the issue number. So I can do this:

$ git commit -m "add css grid support"
# ah fuck, forgot that this is related to an issue!
$ git append-issue 27
# commit msg is now: "add css grid support, #27"

To make it work:

  • Name the shell script git-append-issue (no extension)
  • save it in a folder in your home directory, i.e. ~/git-commands
  • make it executable with chmod 555
  • add that folder to your $PATH
  • git now recognizes your custom command!