git bash常用命名整理
2015-10-09 15:51
453 查看
整理的部分常用gitbash命令
设置用户信息
$ git config --global user.name "zkh"
$ git config --global user.email zkh@qq.com
检查配置信息
$ git config --list
$ git config <key> 检查对应配置
获取帮助
$ git help
$ git help config 获取config命令手册
在现有目录中初始化仓库
$ git init
$ git add *.c
$ git add LICENSE
$ git commit -m 'initial project version'
克隆现有的仓库
$ git clone 地址(https://github.com/libgit2/libgit2)
$ git clone 地址+本地仓库名(https://github.com/libgit2/libgit2 mylibgit)
检查当前文件状态
$ git status
跟踪新文件
$ git add 文件名
暂存已修改文件
$ git add 文件名 CONTRIBUTING.md
状态简览
$ git status -s
查看已暂存和未暂存的修改
$ git diff
提交更新
$ git commit
$ git commit -m "Story 182: Fix benchmarks for speed"(添加提交信息)
移除文件
$ rm (文件名)PROJECTS.md
移动文件
$ git mv file_from file_to
查看提交历史
$ git log(查询全部提交历史,查询中按q终止)
$ git log -p -2(查询最近两次提交)
撤销操作(类似提交未提交完的这种操作)
$ git commit --amend
撤销对文件的修改(将代码返回到上次更新的状态)
$ git stash
查看远程仓库
$ git remote
$ git remote -v (查看需要读写远程仓库使用的 Git 保存的简写与其对应的 URL)
$ git remote show 远程仓库名(origin)
从远程仓库中抓取与拉取
$ git fetch [remote-name]
推送到远程仓库
$ git push origin master
远程仓库的移除与重命名
$ git remote rename pb paul
$ git remote
创建标签
$ git tag -a v1.4 -m 'my version 1.4'
$ git tag(查看标签)
$ git show v1.4(查看标签信息和对应提交信息)
参考链接 https://git-scm.com/book/zh/v2
设置用户信息
$ git config --global user.name "zkh"
$ git config --global user.email zkh@qq.com
检查配置信息
$ git config --list
$ git config <key> 检查对应配置
获取帮助
$ git help
$ git help config 获取config命令手册
在现有目录中初始化仓库
$ git init
$ git add *.c
$ git add LICENSE
$ git commit -m 'initial project version'
克隆现有的仓库
$ git clone 地址(https://github.com/libgit2/libgit2)
$ git clone 地址+本地仓库名(https://github.com/libgit2/libgit2 mylibgit)
检查当前文件状态
$ git status
跟踪新文件
$ git add 文件名
暂存已修改文件
$ git add 文件名 CONTRIBUTING.md
状态简览
$ git status -s
查看已暂存和未暂存的修改
$ git diff
提交更新
$ git commit
$ git commit -m "Story 182: Fix benchmarks for speed"(添加提交信息)
移除文件
$ rm (文件名)PROJECTS.md
移动文件
$ git mv file_from file_to
查看提交历史
$ git log(查询全部提交历史,查询中按q终止)
$ git log -p -2(查询最近两次提交)
撤销操作(类似提交未提交完的这种操作)
$ git commit --amend
撤销对文件的修改(将代码返回到上次更新的状态)
$ git stash
查看远程仓库
$ git remote
$ git remote -v (查看需要读写远程仓库使用的 Git 保存的简写与其对应的 URL)
$ git remote show 远程仓库名(origin)
从远程仓库中抓取与拉取
$ git fetch [remote-name]
推送到远程仓库
$ git push origin master
远程仓库的移除与重命名
$ git remote rename pb paul
$ git remote
创建标签
$ git tag -a v1.4 -m 'my version 1.4'
$ git tag(查看标签)
$ git show v1.4(查看标签信息和对应提交信息)
参考链接 https://git-scm.com/book/zh/v2
相关文章推荐
- 常用上传shell脚本
- shell脚本出错而重复尝试
- Linux学习笔记之<Shell编程初入门>
- shell, python中比较两个日期的先后
- xshell常用快捷键
- 运行脚本提示/bin/bash^M: bad interpreter: No such file or directory
- bat脚本如何自动执行 adb shell 以后的命令
- Xshell无法连接虚拟机中的Ubuntu
- bash shell 命令记录
- python执行shell命令的几种方法
- shell特殊变量 字符截取
- 常见处理文本的SHELL命令
- 常见处理文本的SHELL命令
- 常见处理文本的SHELL命令
- 常见处理文本的SHELL命令
- 常见处理文本的SHELL命令
- 常见处理文本的SHELL命令
- 常见处理文本的SHELL命令
- 常见处理文本的SHELL命令
- 常见处理文本的SHELL命令