Git Set Commit User Profile

git set commit history user.name and user.email

reset git history user

1
2
3
4
5
6
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='oceanpad'
GIT_AUTHOR_EMAIL='zhy20090912@gmail.com'
GIT_COMMITTER_NAME='oceanpad'
GIT_COMMITTER_EMAIL='zhy20090912@gmail.com'
" HEAD

set globle user profile

1
2
git config --globle user.name "oceanpad"
git config --globle user.email "zhy20090912@gmail.com"

set local user profile

under this directory’s set file

1
2
git config --globle user.name "oceanpad"
git config --globle user.email "zhy20090912@gmail.com"

global set file

user’s home dir’s .gitconfig file
open: “vi /home/user/.gitconfig”
or: “vi ~/.gitconfig”

local set file

git folder’s local set file is location at .git folder’s config file
open: “vi .git/config”

config file looks like:

1
2
3
4
5
6
7
8
9
10
11
[user]
name = haiyang
email = zhy20090912@gmail.com
[color]
ui = auto
[alias]
co = commit
br = branch
ci = commit
st = status
ch = checkout
  • All is setting by yourself, You can use command up, or you can config this file directly.