> README.md ...">

git指令

作者: 最念倾城 | 来源:发表于2020-03-18 21:28 被阅读0次

    ​​#一、git初始化本地仓库和配置
    echo "想输入到文件的内容,一般为# 库名字" >> README.md

    git init

    如果没有配置需要配置

    git config --list

    git config --global user.email "abc@bupt.edu.cn"

    git config --global user.name "xy"

    git config --list

    还可以配置git显示颜色

    git config --global color.ui true

    配置别名

    git config --global alias.st status 使用git st 代替 git status

    git config --global alias.co checkout 使用git co 代替 git checkout

    git config --global alias.ci commit 使用git ci 代替 git commit

    git config --global alias.br branch 使用git br 代替 git branch

    有人丧心病狂地把lg配置成了:

    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"

    二、提交文件
    git status 查看当前仓库的状态

    git diff file_name

    git add file2.txt file3.txt 想添加所有的文件git add .

    git status

    git commit -m "提交记录文字“

    git status

    举例:

    git commit -m "Fixes bug"

    如果发现commit信息写错了,

    git commit --amend -m "Fixes bug #42"

    相关文章

      网友评论

          本文标题:git指令

          本文链接:https://www.haomeiwen.com/subject/ikchyhtx.html