log in
register

[Notes] Git的用法

Qingqi@2020-07-20 #notes

身份设置

git config --global user.name "xxx"
git config --global user.email "xxx@xxx.xxx"

SSH设置(linux)

  • 复制id_rsa到~/ssh
  • Adding your SSH key to the ssh-agent
eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa

命令:

st 状态
co 签出
ci + "备注" 提交
br 分支
unstage 撤销修改
lg 查看log
po 上传
fo lo mo 核对并下载
pull 快速下载
t + tagname 打tag
pt + tagname 上传tag
clone + git@github.com:xxx/xxx.git 本地克隆

~目录下.gitconfig文件(别名)修改如下

[user]
    name = xxx
    email = xxx@gmail.com
[color]
        ui = true
[alias]
        st = status
        co = checkout
        ci = commit -m
        br = branch
        unstage = reset HEAD
        last = log -1
        lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
        po = push origin master
        fo = fetch origin master
        lo = log -p master..origin/master
        mo = merge origin/master
        t  = tag -a
        pt = push origin
Comments

Log in to add your comment

Don't have an account? register here