git 回滚:
(1)本地回滚
git reset --hard 版本号
(2)强行回滚到远程服务器:
git push -f
git diff commit_previous commit > mypatch.diff :最原始的diff信息,对于这里的commit_previous(commit之前一个commit),可以使用“commit^”来表示,这样比较方便,不易出错。
http://stackoverflow.com/questions/791959/download-a-specific-tag-with-git
https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes
git remote -v
git remote add binlijin-druid-api https://github.com/binlijin/druid-api
git push -f binlijin-druid-api
git pull origin
创建新分支并立即切换到新分支:$ git checkout -b [name]
$ git checkout -b iss53
这相当于执行下面这两条命令:
$ git branch iss53
$ git checkout iss53
//删除分支
$ git branch -d 0.8.3
//checkout远程分支
$ git fetch origin
$ git branch -v -a
$ git checkout -b 0.8.3 origin/0.8.3
http://stackoverflow.com/questions/1783405/checkout-remote-git-branch
$ git remote -v
binlijin-druidhttps://github.com/binlijin/druid.git (fetch)
binlijin-druidhttps://github.com/binlijin/druid.git (push)
originhttps://github.com/druid-io/druid.git (fetch)
originhttps://github.com/druid-io/druid.git (push)
$ git branch optimize-create-inverted-indexes
$ git checkout optimize-create-inverted-indexes
$ git push binlijin-druid
$ git pull origin master
http://stackoverflow.com/questions/791959/download-a-specific-tag-with-git
git clone http://git.abc.net/git/abc.git my_abc
After the clone, you can list the tags with git tag -l
and then checkout a specific tag: git checkout tags/<tag_name>
git checkout tags/<tag_name> -b <tag_name>
git branch -va
可以查看本地+远程分支列表
当克隆一个仓库时,它通常会自动地创建一个跟踪 origin/master 的 master 分支。
然而,如果你愿意的话可以设置其他的跟踪分支 - 其他远程仓库上的跟踪分支,
或者不跟踪 master 分支。 最简单的就是之前看到的例子,运行
git checkout -b [branch] [remotename]/[branch]。
这是一个十分常用的操作所以 Git 提供了 --track 快捷方式:
$ git checkout --track origin/serverfix
Branch serverfix set up to track remote branch serverfix from origin.
Switched to a new branch 'serverfix'
http://memoryboxes.github.io/blog/2014/12/07/duo-ge-gitzhang-hao-zhi-jian-de-qie-huan/
git config --list
git config --global user.name "Your Name"
git config --global user.email you@example.com
全局的通过vim ~/.gitconfig来查看
git config user.name "Your Name"
git config user.email you@example.com
局部的通过当前路径下的 .git/config文件来查看
也可以修改提交的用户名和Email:
git commit --amend --author='Your Name <you@example.com style="word-wrap: break-word; color: rgb(102, 102, 102); font-family: 宋体, Arial; font-size: 16px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);">' http://blog.chinaunix.net/uid-26997997-id-3231891.html