Git命令本质

引言

这是以前学习Git时的个人理解,算是速查手册吧

Command Essential
base^n 选择base分支的第n个父分支
base~n 选择base的第n级父结点
git commit --amend 产生一个已提交结点的兄弟结点
git tag label to 为to结点赋与标签label
git branch -f from to 将分支from指向to
git merge from 将分支from合并到当前活动分支
git rebase to from 拷贝分支from(缺省为当前活动分支),接续到分支to的后面
git reabse -i base_offset 对base第offset个父结点以下的结点进行交互排序
git cherry-pick c1 c2 ... 撷取结点c1、c2等接到当前活动分支之后
git reset base_offset 将分支base的指向回溯到其第offset级父结点
git revert base_offset 拷贝一份base第offset级父结点,接续到当前结点之后
repo/branch 远程仓库repo的branch分支
git branch -u remote local 将远程分支remote绑定到本地已有分支local
git checkout -b local remote 新建本地分支local,绑定至远程分支remote
git pull --rebase 采取rebase而不是默认的merge模式,拉取远程分支
git fetch repo remote:local 下载远程remote分支的副本到本地的local分支(非活动分支),省略remote时将在本地创建local分支
git pull repo remote:local 先fetch再merge入当前活动分支
git push repo local:remote 将本地分支local推送至远程仓库repo的remote分支,省略local时将会删除远程分支
posted @ 2020-04-24 20:53  没头脑的老毕  阅读(187)  评论(0编辑  收藏  举报