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

推荐订阅源

博客园_首页
Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
Martin Fowler
Martin Fowler
B
Blog
The GitHub Blog
The GitHub Blog
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
月光博客
月光博客
人人都是产品经理
人人都是产品经理
IT之家
IT之家
GbyAI
GbyAI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
C
Check Point Blog
罗磊的独立博客

blag

SQLite prefixes its temp files with `etilqs_` - blag Setsum - order agnostic, additive, subtractive checksum - blag Oldest recorded transaction - blag Replacing a cache service with a database - blag SQLite commits are not durable under default settings - blag PSA: SQLite WAL checksums fail silently and may lose data - blag Rickrolling Turso DB (SQLite rewrite in Rust) - blag Collection of insane and fun facts about SQLite - blag How bloom filters made SQLite 10x faster - blag In search of a faster SQLite - blag Galloping Search - blag Building a distributed log using S3 (under 150 lines of Go) - blag Zero Disk Architecture - blag PSA: Most databases do not do checksums by default - blag PSA: SQLite does not do checksums - blag Disaggregated Storage - a brief introduction - blag Why does SQLite (in production) have such a bad rep? - blag SQLite Slaps - blag Now - blag Learning C - blag Snapshot Testing - blag Win: contribution to libSQL (SQLite) codebase - blag Errata in Hekaton MVCC paper - blag Internet is wholesome: MVCC edition - blag It is becoming difficult for me to be productive in Python - blag MongoDB secondary only index - blag Introducing CaskDB – a project to teach you writing a key-value store - blag Recurse Center: Winter Break - blag Recurse Center Day 24: Hacking Go compiler to add a new keyword - blag Recurse Center Day 20: Django v4 upgrade (from v1) - blag
How I Am Maintaining Multiple Emails For Git On A Same Ma...
2015-08-02 · via blag

Every git commit is associated with two important data: your name and email. I don’t want my personal email address associated with work related git commits and vice versa. First, to set the git email address system wide, you would run following:

$git config --global user.email "[email protected]"
$git config --global user.name "Your Name"

and every commits will have above info. To set the email address for individual repo, just drop the global. cd into your repository and run the following:

$git config user.email "[email protected]"
$git config user.name "Your Name"

Now every commit for this repository will have above email. There is another way, by modifying .git/config of your repository and including a [user] block, something like:

[core]
    ...
[remote "origin"]
    ...
[branch "master"]
    ...
[user]
    name = Your Name
    email = [email protected]

Problems

Though above mentioned methods work, there are two major issues (at least for me):

  1. You have to run the above command everytime you create a new repository.
  2. You have to remember #1.

#2 is actually difficult for me.

Solution

Use direnv. direnv is one nifty tool which lets you have different environment variables based on directories/path. The best part is, as soon as you enter into a directory, direnv does it’s magic, so you don’t have to remember that you have to run direnv. For direnv to work, you have to create a file called .envrc where you can specify what all environment variables you want and place it the directory.

This is how I have organized my repositories:

~/
|- work # all work related repos go here
    |-- .envrc
    |-- repo-1
    |-- ...
    |-- repo_X
|- Documents/code # all my personal projects go here
    |-- .envrc
    |-- repo-1
    |-- ...
    |-- repo_X

So, my ~/work/.envrc contains:

export GIT_AUTHOR_EMAIL="[email protected]"
export GIT_COMMITTER_EMAIL="[email protected]"

similarly, my ~/Documents/code/.envrc contains:

export GIT_AUTHOR_EMAIL="[email protected]"
export GIT_COMMITTER_EMAIL="[email protected]"

Before each prompt direnv checks for .envrc in current directory and parent directories. And when the file is found, it applies those and those variables will be present in your shell. You can also add GIT_AUTHOR_NAME or GIT_COMMITTER_NAME if you want to use different names in git commits.

References: