git
- what's difference between
git revert
andgit reset
.
都是撤销修改记录,其中,reset 是取消一个提交;revert 是修改内容然后生成一个新的提交。必须指出的是:reset 在远程不生效,如果需要撤销远程的提交,需要使用 revert.
git cherry-pick
and interactivegit rebase
当你需要整理提交记录的时候(即让某些想要的提交记录形成提交链.)或者只需要指定的几个提交记录时, 就可以用
git cherry-pick
andgit rebase
. interactive git rebase meansgit rebase -i
rebase --interactive
对提交记录自由重新排序. 主要用于合并分支的时候
cherry-pick
可以获取任何节点,除了当前分支及当前分支的父节点以外。然后加到当前节点下。比如"拾取需要的节点合并到主分支"https://oschina.gitee.io/learn-git-branching/.
- git Tag
这个对我来说是重点,因为以前从来没了解过.
tag 可以锚定一个提交,并且在不主动删除的情况下永远引用它.(与分支相对应的是分支可以修改、提交、移动)git tag -h
to read usage.
- what is the difference between HEAD, index and working tree.
- HEAD, A reference that reference to branch or some commit. It means where are you in currently.
- index, or staging area. Here is where something prepare to commit and compares the files in working tree and files in the repository.
- working tree, It is you are working place, you can assume it as file system where you can view and changes file.
-- git reset
reset the current HEAD to the specified state.
The form git reset [-q] [<tree-ish>] [--] <pathspec>
means that git reset <pathspec>
is the opposite of git add <pathspec>
-
some standard behaviors
- using
git fetch
intead ofgit pull
, and you can choose neithergit merge
orgit rebase
- using
-
git log show what changed.
git log --raw