GIT 的常见用法

git init 新建代码库

git clone新建项目

git branch 查看分支
git config 显示配置
git config -e 显示配置文件
git config user.name “名称”
git config user.email “邮件”
git add 添加到展览区
git commit -m 提交到展缓区域
git commit -v 显示所有diff信息
git branch 列出所有本地分支
git branch -r 所有远程分之
git branch -a 所有本地 远程 分之
git branch branch-name 新建分之 依然停留在该分组
git checkout branch-name 切换到指定分之 并更新工作区
git branch - 切换到上一个分支
git merge branch 合并指定分支到当前分支
git cherry-pick commit 选择一个commit 合并当前分支
git branch -d 删除分支
git tag 列出所有tag
git tag tag 新建tag在当前的commit
git show 查看tag信息
git push remote tag 提交指定 tag
git push remote tags 提交所有的tag
git checkout -b 新建分之 指向某个tag
git status 显示所有变更的文件
git log 显示当前分支的版本历史
git log stat 显示commit历史,以及每次commit发生变更的文件
git log -s搜索提交历史
git diff 显示暂缓区 与工作区的差异
git diff --ached 显示暂存区喝上一个commit的差异
git dff HEAD 显示工作区与当前分支最新commit之间的差异
git diff --shortstat "@{ 0 day ago}" 显示今天写了多少代码
git show 显示某次提交的元数据和内容变化
git reflog 显示当前分支的最近几次提交
git fetch 下载远程仓库所有的变动
git remote -v 显示所有远程仓库
git remote show 显示缪尔远程仓库的信息
git remote add name URL 增加一个新的远程仓库,并命名
git pull remote branch 去回远程仓库的变化,并与本地分支合
git push remote branch 上传本地指定分支到远程仓库
git push remote --force 强行推送当前分支到远程仓库,
git push remote -all 推送所有分支到远程仓库
git checkout 文件  恢复暂存区的指定文件到工作区

git checkout commit 文件 恢复某个commit的指定文件到暂存区

 

猜你喜欢

转载自www.cnblogs.com/lzhsus/p/11396203.html