git commit 提交到暂存区
git checkout master 将HEAD指针指向master
HEAD指针指向当前的版本位置
git branch newBranch 创建newBranch分支
git checkout newBranch 将HEAD指针指向newBranch
git commit 提交到暂存区
git init 初始化本地库
git clone 复制云端代码到本地第一次
git fetch 复制云端代码到本地
git pull = git fetch git merge
git pull --rabase =git fetch git rebase
git fetch o/origin newBranch:master 将远端newBranch分支变化更新到本地,并将本地的master指向本地同步的newBranch的位置
git fetch o/origin :newBranch将远端变化更新到本地,并生成newBranch分支
git push o/origin :newBranch将变化更新到远端,并删除newBranch分支
git push 上传代码
git push o/origin newBranch:master 将指定分支变化更新到远端,并将远端的master指向本地同步的newBranch的位置
git merge newBranch 将 newBranch 合并到当前分支
git rebase newBranch 将当前节点移动到newBranch 上
git rebase newBranch master 将master节点移动到newBranch 上
git branch -f master master^ 把master移到master的上一个
git branch -f master master~3 把master移到master的上三个
git branch -f master master^3 把master移到master的第三个父分支并回退一个
git reset master~1 回退一个版本,少一个节点
git revert matser 回退一个版本,多一个节点,与回退上个节点之前的状态一样,可上传服务器
git cherry-pick c3 将c3的更改信息应用于当前节点
git rebase -i master~4 以交互的方式改变master的前四个节点的位置,支持换位置、删除等;
git tag c3 v0 给c3节点打上v0的标签,用于标记大版本更新;
git describe master 返回 v0_3_gc2 表示master指向c2距离master最近的标签是v0距离为3
git commit --amend
一般本地分支叫master 远程分支也叫master但是本地与远程master同步的指针叫 origin/master 或 o/master
git checkout -b totallyNotMaster o/master 在本地使用totallyNotMaster 代替master同步远端的o/master
git checkout -u o/master totallyNotMaster 在本地使用totallyNotMaster 代替master同步远端的o/master
练习网站