Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git config 小筆記 #12

Open
JeffKko opened this issue Aug 9, 2019 · 0 comments
Open

git config 小筆記 #12

JeffKko opened this issue Aug 9, 2019 · 0 comments
Labels

Comments

@JeffKko
Copy link
Owner

JeffKko commented Aug 9, 2019

git config 小筆記

init profile

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

check profile

$ git config --global --list
# or
$ git config -l

ssh key

# check ssh key exist
ls -al ~/.ssh

# gen ssh key
$ ssh-keygen -t rsa -C "[email protected]"

# copy public key
$ cat ~/.ssh/id_rsa.pub | clip

alias

$ git config --global alias.co checkout
$ git config --global alias.br branch
$ git config --global alias.ci commit
$ git config --global alias.st status
$ git config --global alias.l "log --oneline --graph"
$ git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

或者直接編輯設定檔

$ vi ~/.gitconfig
[alias]
    co = checkout
    br = branch
    # 利出 local 與 remote branch
    brav = branch -av
    ci = commit
    st = status
    l = log --oneline --graph
    # 漂亮一點的 log, 而 ls -p 可以看到變動的內容
    ls = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

check branch

$ git branch

# or
$ git branch -r # 遠端的
$ git branch -a # remote + local

參考

@JeffKko JeffKko added the tool label Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant