Git 常用指令记录

标准指令以及功能
指令 功能
git clone 仓库链接 从远端仓库克隆工程
git init 初始化仓库
git checkout -b 新的分支名字 创建新的分支并切换过去
git push -u origin 新的分支 将本地新的分支推送至远端
git branch -m 老名 新名 修改本地分支名字
git merge B 在分支 A的情况下合并 B分支内容 到 A分支
git reset HEAD --hard 强迫放弃本地所有被追踪到的更改
git fetch 重新检索远端分支(远端有的分支本地确无法读到和拉取时使用)
git pull 更新本地代码(拉代码)
git add . 将修改的文件提交到暂存区域
git commit -m “注释" 将改动的文件提交到本地仓库(还没有推送远端仓库)
git push 推送代码到远端(上传代码)
git branch -d 分支名字 删除本地分支[分支名字]
git push origin :分支名字 删除远端仓库分支[分支名字]
git branch -v 获取分支的最后一次提交
git branch --merged 查看已合并到当前分支的分支
git branch 查看本地分支
git branch -a 查看远端分支
git stash 暂存代码
git stash pop 将暂存代码pop出来
git checkout . 撤销当前分支所有修改
git checkout 某个文件 撤销对[某个文件]的修改
git show 显示最后一次文件更改的内容
git log --stat 修改的文件列表, 及文件修改的统计
git whatchanged 修改的文件列表

OhMyZsh- GitCheatSheet
简写指令 原本指令
g git
gst git status
gl git pull
gup git pull --rebase
gp git push
gd git diff
gdc git diff --cached
gc git commit -v
gc! git commit -v --amend
gca git commit -v -a
gcmsg git commit -m
gco git checkout
gcm git checkout master
gr git remote
grv git remote -v
grmv git remote rename
gb git branch
gba git branch -a
gcl git config --list
gcp git cherry-pick
gss git status -s
ga git add
gm git merge
grh git reset HEAD
grhh git reset HEAD --hard
gsta git stash
gstp git stash pop
gstd git stash drop
ggpull git pull origin $(current_branch)
ggpush git push origin $(current_branch)

你可能感兴趣的:(Git 常用指令记录)