git常用命令,通用

$ git config --global user.name "zvxf"
$ git config --global user.email zvxf@outlook.com
$ ssh-keygen -t rsa -C 'zvxf@outlook.com'
$ git config --global core.editor vim
$ git config --list
$ git config <key>
$ git help config
$ git init
$ git add LICENSE
$ git commit -m 'initial project version'
$ git clone [url]
$ git status 检查当前文件状态
$ git status -s
$ cat .gitignore 忽略文件
$ git diff 查看尚未暂存的文件修改
$ git diff --cached 查看已经暂存起来的变化
$ git commit -m 提交
$ git commit -a 一并提交
$ git commit --amend 重新提交
$ git rm -r 删除
$ git mv filename1 filename2 改名
$ git checkout 撤消
$ git remote -v 查看远程仓库
$ git remote show origin 查看某个远程仓库
$ git remote rename  filename1 filename2 重命名
$ git remote add <shortname> <url> 添加远程仓库
$ git fetch [remote-name] 拉取远程仓库
$ git pull origin master   拉取远程仓库
$ git push origin master 推送
$ git remote rm origin 删除
$ git remote add origin git@github.com:zvxf/zvxf.github.io.git 同步
$ git tag 列出标签
$ git tag -a 具体标签
$ git tag -l 简单标签
$ git tag -d 删除标签
$ git push origin --tags 推送很多标签
$ git show 浏览
$ git config --global alias.ci commit 别名 外部命令加!
$ git config --global alias.unstage 'reset HEAD --' 取消暂存别名
$ git last 最后一次提交
$ git log
{
-p

按补丁格式显示每个更新之间的差异。

--stat

显示每次更新的文件修改统计信息。

--shortstat

只显示 --stat 中最后的行数修改添加移除统计。

--name-only

仅在提交信息后显示已修改的文件清单。

--name-status

显示新增、修改、删除的文件清单。

--abbrev-commit

仅显示 SHA-1 的前几个字符,而非所有的 40 个字符。

--relative-date

使用较短的相对时间显示(比如,“2 weeks ago”)。

--graph

显示 ASCII 图形表示的分支合并历史。

--pretty

使用其他格式显示历史提交信息。可用的选项包括 oneline,short,full,fuller 和 format(后跟指定格式)。
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值