Git

4652 readers
4 users here now

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Resources

Rules

  1. Follow programming.dev rules
  2. Be excellent to each other, no hostility towards users for any reason
  3. No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 2 years ago
MODERATORS
1
2
3
 
 

Whenever I do a git revert I go into an edit session with the following pre-filled.

Revert "wip: does this work?"

This reverts commit ad21a2ae23166b3f3cddoooooooom94821e3cdb4.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
...

...and so on.

I like to use conventional commits, so I change this to revert: "wip: does this work?".

Is there a way to get the initial template for the revert commit message to appear this way by default? Lowercase, and with a colon.


UPDATE This is what I came up with

#!/bin/bash

COMMIT_MSG_FILE=$1

old_subject_line=$(head -1 $COMMIT_MSG_FILE)

# Not a revert
if [[ ! "$old_subject_line" =~ ^Revert\ \" ]]
then
    exit 0
fi

new_subject_line=$(echo $old_subject_line|sed 's/^Revert/revert:/')

sed -i "1s/.*/$new_subject_line/" $COMMIT_MSG_FILE

Curiously, the case where two "Reverts" in a row become a "Reapply" doesn't come up like I thought it would. Maybe it only happens if you use the default Revert "yada yada yada" subject line.

4
5
6
7
8
9
10
 
 

cross-posted from: https://programming.dev/post/49019468

Hey, I made a thing! It's called doink. Doink gives you dynamic git remotes by using DNS TXT records as pointers.

I wrote a bit about how it works and what it's useful for.

Anyway, do you ever thing about how DNS is a basically a decentralized key-value database? I think about it a lot :)

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
view more: next ›