-
Notifications
You must be signed in to change notification settings - Fork 2
git
William Zhang edited this page May 11, 2017
·
2 revisions
http://www.cheat-sheets.org/#Git
$ sudo yum install git-web $ git gui ...
$ sudo yum install gitk $ gitk
$ sudo yum install gitweb $ man gitweb $ sudo yum install lighttpd $ cd ~/github/misc $ git instaweb
http://git-scm.com/book/
$ git checkout -b dev-review origin/dev
$ git branch <your branch> // Switch to branch $ git pull origin master // Sync master changes inside your branch $ git diff --name-only master <branch> // List of the changed files
$ git log --merges
$ git log | more
再做diff
$ git diff <hash> HEAD
先找到文件的修改历史
$ git log sql/sys_vars.cc
从中找到两个待比较的hash值,再开始比较
$ git diff hash1 hash2 -- sql/sys_vars.cc ** 在有未决冲突时,怎么回滚掉这些未决的文件? 例如: #+NAME: <s> $ git checkout master sql/field.cc: needs merge sql/sql_show.cc: needs merge sql/sql_show.h: needs merge sql/sql_yacc.yy: needs merge error: you need to resolve your current index first
$ git reset --merge
$ git clean -f But beware... there's no going back. Use -n or --dry-run to preview the damage you'll do.
$ git reset --hard HEAD~1 The HEAD~1 means the commit before head.
$ git reset --hard <sha1-commit-id>
- 如果已经提交到了远程,则还需要push一下
If you already pushed it, you will need to do a force push to get rid of it…
$ git push origin HEAD --force
git revert <hash> git reset HEAD Makefile
Created by Wenliang Zhang.