2016年9月

今天去麦德龙购物,回来开机失败:
系统是:Linux Mint 18
之前关机正常,提示错误如下:

/etc/mdm/Xsession:Begining session setup...
/etc/mdm/Xsession:29:/home/duuge/.profile:[[:not found
/etc/mdm/Xsession:173:/etc/mdm/Xsession:grep not found
/etc/mdm/Xsession:Executing cinnamon-session-cinnamon cinnamon failed,will try to run x-terminal-emulator
/etc/mdm/Xsession:205:exec:x-terminal-emulator not found

截图如下2图:
图1:
IMG_20160926_231600.jpg
图2:
IMG_20160926_231609.jpg

解决方法:

1、尝试重启进入kde模式未果(因为设置了简体中文语言,所以命令提示符下都是乱码);
2、用Linux Mint 18的U盘系统安装优盘启动笔记本电脑,然后找到最后我的印象中最后一次对.profile的操作,用#井号禁用里面的配置项,重启电脑,成功解决!

环境:Linux Mint 18+Nvidia driver

在Android Studio 2.2中启动AVD报错:

Cannot launch AVD in emulator. 
Output: libGL error: driver pointer missing libGL 
error: failed to load driver: nouveau libGL 
error: unable to load driver: swrast_dri.so libGL 
error: failed to load driver: swrast X 
Error of failed request:  GLXBadContext

http://stackoverflow.com/questions/36189393/android-studio-avd-error-launching找到一个不算解决的解决办法
https://gist.github.com/NickGeek/1e125d7ca6aeff2d4e0e3ac2399bc14c的avd_selection.py文件放到/home/duuge/Android/Sdk/tools目录下(具体按你自己的安卓的sdk目录而定),然后启动命令行并切到这个目录下运行命令python avd_selection.py:

duuge@linuxmint ~/Android/Sdk/tools $ python avd_selection.py

可临时解决。
随文附上avd_selection.py文件的压缩包。

avd_selection.py.tar.gz

参考:https://wiki.dolibarr.org/index.php/Zh_Translator_documentation

基于Linux Mint 18

DolibarrQQ群原创:206239089 (简体中文翻译交流)

1.安装transifex-client:提示没安装但最新版本是0.12的而apt-get install的是0.10这个版本不能用有问题的。于是继续下面步骤。

2.安装python pip:

sudo apt-get install python-pip

3.安装setuptools:

sudo pip install setuptools

4.安装transifex-client:

sudo pip install transifex-client

sudo easy_install install transifex-client

5.执行下面命令:

tx -d pull -l zh_CN

报错,提示:

duuge@Latitude-E6410 ~/github/dolibarr-tx $ tx -d pull -l zh_CNPath to tx is /home/duuge/github/dolibarr-tx.
Config file is /home/duuge/github/dolibarr-tx/.tx/config
.transifexrc file is at /home/duuge/github/dolibarr-tx
.transifexrc file is at /home/duuge
/home/duuge/.transifexrc not found.
Handling resource dolibarr.accountancy
Language mapping is: Flipdict({'sw': 'sw_SW', 'sr@latin': 'sr_RS', 'uz': 'uz_UZ'})
URL data are: {'project': 'dolibarr', 'host': 'https://www.transifex.com', 'resource': 'accountancy'}
No user credentials found for host https://www.transifex.com. Edit ~/.transifexrc and add the appropriate info in there.
Exception: No user credentials found for host https://www.transifex.com. Edit ~/.transifexrc and add the appropriate info in there.

看到:Edit ~/.transifexrc这文件没配置好。好吧用命令tx init初始化一下就解决。

tx init

会提示输入你在transifex网站的账号和密码。
完了之后继续 执行

补全一下.tx文件夹下的config配置文件(有点长)文件在github的dolibarr源代码的.tx文件夹下:
右键另存为千万别直接点击:https://github.com/Dolibarr/dolibarr/blob/develop/.tx/config

[main]
host = https://www.transifex.com
lang_map = uz: uz_UZ, sw: sw_SW, sr@latin: sr_RS
 
[dolibarr.accountancy]
file_filter = htdocs/langs/<lang>/accountancy.lang
source_file = htdocs/langs/en_US/accountancy.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.admin]
file_filter = htdocs/langs/<lang>/admin.lang
source_file = htdocs/langs/en_US/admin.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.agenda]
file_filter = htdocs/langs/<lang>/agenda.lang
source_file = htdocs/langs/en_US/agenda.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.banks]
file_filter = htdocs/langs/<lang>/banks.lang
source_file = htdocs/langs/en_US/banks.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.bills]
file_filter = htdocs/langs/<lang>/bills.lang
source_file = htdocs/langs/en_US/bills.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.bookmarks]
file_filter = htdocs/langs/<lang>/bookmarks.lang
source_file = htdocs/langs/en_US/bookmarks.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.boxes]
file_filter = htdocs/langs/<lang>/boxes.lang
source_file = htdocs/langs/en_US/boxes.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.cashdesk]
file_filter = htdocs/langs/<lang>/cashdesk.lang
source_file = htdocs/langs/en_US/cashdesk.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.categories]
file_filter = htdocs/langs/<lang>/categories.lang
source_file = htdocs/langs/en_US/categories.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.commercial]
file_filter = htdocs/langs/<lang>/commercial.lang
source_file = htdocs/langs/en_US/commercial.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.companies]
file_filter = htdocs/langs/<lang>/companies.lang
source_file = htdocs/langs/en_US/companies.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.compta]
file_filter = htdocs/langs/<lang>/compta.lang
source_file = htdocs/langs/en_US/compta.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.contracts]
file_filter = htdocs/langs/<lang>/contracts.lang
source_file = htdocs/langs/en_US/contracts.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.cron]
file_filter = htdocs/langs/<lang>/cron.lang
source_file = htdocs/langs/en_US/cron.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.deliveries]
file_filter = htdocs/langs/<lang>/deliveries.lang
source_file = htdocs/langs/en_US/deliveries.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.dict]
file_filter = htdocs/langs/<lang>/dict.lang
source_file = htdocs/langs/en_US/dict.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.donations]
file_filter = htdocs/langs/<lang>/donations.lang
source_file = htdocs/langs/en_US/donations.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.ecm]
file_filter = htdocs/langs/<lang>/ecm.lang
source_file = htdocs/langs/en_US/ecm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.errors]
file_filter = htdocs/langs/<lang>/errors.lang
source_file = htdocs/langs/en_US/errors.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.exports]
file_filter = htdocs/langs/<lang>/exports.lang
source_file = htdocs/langs/en_US/exports.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.externalsite]
file_filter = htdocs/langs/<lang>/externalsite.lang
source_file = htdocs/langs/en_US/externalsite.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.ftp]
file_filter = htdocs/langs/<lang>/ftp.lang
source_file = htdocs/langs/en_US/ftp.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.help]
file_filter = htdocs/langs/<lang>/help.lang
source_file = htdocs/langs/en_US/help.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.holiday]
file_filter = htdocs/langs/<lang>/holiday.lang
source_file = htdocs/langs/en_US/holiday.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.hrm]
file_filter = htdocs/langs/<lang>/hrm.lang
source_file = htdocs/langs/en_US/hrm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.incoterm]
file_filter = htdocs/langs/<lang>/incoterm.lang
source_file = htdocs/langs/en_US/incoterm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.install]
file_filter = htdocs/langs/<lang>/install.lang
source_file = htdocs/langs/en_US/install.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.interventions]
file_filter = htdocs/langs/<lang>/interventions.lang
source_file = htdocs/langs/en_US/interventions.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.languages-not-res]
file_filter = htdocs/langs/<lang>/languages.lang
source_file = htdocs/langs/en_US/languages.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.ldap]
file_filter = htdocs/langs/<lang>/ldap.lang
source_file = htdocs/langs/en_US/ldap.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.link]
file_filter = htdocs/langs/<lang>/link.lang
source_file = htdocs/langs/en_US/link.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.loan]
file_filter = htdocs/langs/<lang>/loan.lang
source_file = htdocs/langs/en_US/loan.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.mailmanspip]
file_filter = htdocs/langs/<lang>/mailmanspip.lang
source_file = htdocs/langs/en_US/mailmanspip.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.mails]
file_filter = htdocs/langs/<lang>/mails.lang
source_file = htdocs/langs/en_US/mails.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.main]
file_filter = htdocs/langs/<lang>/main.lang
source_file = htdocs/langs/en_US/main.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.margins]
file_filter = htdocs/langs/<lang>/margins.lang
source_file = htdocs/langs/en_US/margins.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.members]
file_filter = htdocs/langs/<lang>/members.lang
source_file = htdocs/langs/en_US/members.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.oauth]
file_filter = htdocs/langs/<lang>/oauth.lang
source_file = htdocs/langs/en_US/oauth.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.opensurvey]
file_filter = htdocs/langs/<lang>/opensurvey.lang
source_file = htdocs/langs/en_US/opensurvey.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.orders]
file_filter = htdocs/langs/<lang>/orders.lang
source_file = htdocs/langs/en_US/orders.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.other]
file_filter = htdocs/langs/<lang>/other.lang
source_file = htdocs/langs/en_US/other.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.paybox]
file_filter = htdocs/langs/<lang>/paybox.lang
source_file = htdocs/langs/en_US/paybox.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.paypal]
file_filter = htdocs/langs/<lang>/paypal.lang
source_file = htdocs/langs/en_US/paypal.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.printing]
file_filter = htdocs/langs/<lang>/printing.lang
source_file = htdocs/langs/en_US/printing.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.productbatch]
file_filter = htdocs/langs/<lang>/productbatch.lang
source_file = htdocs/langs/en_US/productbatch.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.products]
file_filter = htdocs/langs/<lang>/products.lang
source_file = htdocs/langs/en_US/products.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.projects]
file_filter = htdocs/langs/<lang>/projects.lang
source_file = htdocs/langs/en_US/projects.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.propal]
file_filter = htdocs/langs/<lang>/propal.lang
source_file = htdocs/langs/en_US/propal.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.receiptprinter]
file_filter = htdocs/langs/<lang>/receiptprinter.lang
source_file = htdocs/langs/en_US/receiptprinter.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.resource]
file_filter = htdocs/langs/<lang>/resource.lang
source_file = htdocs/langs/en_US/resource.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.salaries]
file_filter = htdocs/langs/<lang>/salaries.lang
source_file = htdocs/langs/en_US/salaries.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.sendings]
file_filter = htdocs/langs/<lang>/sendings.lang
source_file = htdocs/langs/en_US/sendings.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.sms]
file_filter = htdocs/langs/<lang>/sms.lang
source_file = htdocs/langs/en_US/sms.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.stocks]
file_filter = htdocs/langs/<lang>/stocks.lang
source_file = htdocs/langs/en_US/stocks.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.suppliers]
file_filter = htdocs/langs/<lang>/suppliers.lang
source_file = htdocs/langs/en_US/suppliers.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.supplier_proposal]
file_filter = htdocs/langs/<lang>/supplier_proposal.lang
source_file = htdocs/langs/en_US/supplier_proposal.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.trips]
file_filter = htdocs/langs/<lang>/trips.lang
source_file = htdocs/langs/en_US/trips.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.users]
file_filter = htdocs/langs/<lang>/users.lang
source_file = htdocs/langs/en_US/users.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.withdrawals]
file_filter = htdocs/langs/<lang>/withdrawals.lang
source_file = htdocs/langs/en_US/withdrawals.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.website]
file_filter = htdocs/langs/<lang>/website.lang
source_file = htdocs/langs/en_US/website.lang
source_lang = en_US
type = MOZILLAPROPERTIES
 
[dolibarr.workflow]
file_filter = htdocs/langs/<lang>/workflow.lang
source_file = htdocs/langs/en_US/workflow.lang
source_lang = en_US
type = MOZILLAPROPERTIES

6.执行下面命令:

tx -d pull -l zh_CN

成功!

duuge@Latitude-E6410 ~/github/dolibarr-tx $ tx -d pull -l zh_CN
Path to tx is /home/duuge/github/dolibarr-tx.
Config file is /home/duuge/github/dolibarr-tx/.tx/config
.transifexrc file is at /home/duuge/github/dolibarr-tx
.transifexrc file is at /home/duuge
Handling resource dolibarr.accountancy
Language mapping is: Flipdict({'sw': 'sw_SW', 'sr@latin': 'sr_RS', 'uz': 'uz_UZ'})
URL data are: {'project': 'dolibarr', 'host': 'https://www.transifex.com', 'resource': 'accountancy'}
Statistics response is {
    "ar_SA": {
        "reviewed_percentage": "70%", 
        "completed": "70%", 
        "untranslated_words": 229, 
        "last_commiter": "eldy", 
        "reviewed": 97, 
        "translated_entities": 97, 
        "translated_words": 503, 
        "last_update": "2016-08-30 23:05:18", 
        "untranslated_entities": 40
    }, 
    "en": {
        "reviewed_percentage": "0%", 
        "completed": "100%", 
        "untranslated_words": 0, 
        "last_commiter": "eldy", 
        "reviewed": 0, 
        "translated_entities": 137, 
        "translated_words": 732, 
        "last_update": "2016-08-30 23:05:19", 
        "untranslated_entities": 0
    }, 

......
......
......

Adding to new translations: set([])
Pulling languages for: set(['zh_CN'])
Pulling translations for resource dolibarr.workflow (source: htdocs/langs/en_US/workflow.lang)
Using file htdocs/langs/zh_CN/workflow.lang
Remote time is 1473712800.0 and local 1473713460.0
Local is newer than remote for lang zh_CN
Skipping 'zh_CN' translation (file: htdocs/langs/zh_CN/workflow.lang).
Done.
duuge@duuge-Latitude-E6410 ~/github/dolibarr-tx $ 

'tools.jar' seems to be not in studio classpath.
please ensure JAVA_HOME points to JDK rether than JRE.

解决办法:

解决办法:到http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
下载JDK得到jdk-8u101-linux-x64.tar.gz,解压

tar xzvf jdk-8u101-linux-x64.tar.gz

解压为jdk文件夹,然后

sudo mv jdk /usr/lib/jvm

(如果还没有jvm文件夹则mkdir /usr/lib/jvm/创建一个文件夹解决)。

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk/bin/javaws 1
sudo update-alternatives --config java
sudo update-alternatives --config javaws

OK完成了,测试一下看看java是否安装成功:查java版本号出来是java8的就行:

java -version

返回:

java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

需要手动命令行同步下载或上传简体中文语言至odoo官方transefix的步骤如下:

1.安装pip:

sudo apt-get install python-pip

2.安装transifex-client:

sudo pip transifex-client

sudo easy_install install transifex-client

3.初始化tx环境:

tx init

会生成文件夹.tx以及在该文件夹下生成config配置文件用于稍后的动作.

4.以odoo8.0的简体中文语言为例:
复制https://github.com/odoo/odoo/blob/8.0/.tx/config到刚才的tx init生成的config配置文件中保存.

5.输入命令:

tx pull -r "odoo-8.*" -l zh_CN

将zh_CN简体中文语言pull下载回来本地.

6.更多详见odoo官方文档:
https://github.com/odoo/odoo/wiki/Translations

转载:Git常用命令http://www.lenggirl.com/code/git-use.html

Aug 16, 2016 • hunterhug • git

点击...伟大的程序员
一、新建代码库
二、配置
三、增加/删除文件
四、代码提交
五、分支
六、标签
七、查看信息
八、远程同步
九、撤销
十、其他
作者: 阮一峰

日期: 2015年12月 9日

我每天使用 Git ,但是很多命令记不住。

一般来说,日常使用只要记住下图6个命令,就可以了。但是熟练使用,恐怕要记住60~100个命令。

下面是我整理的常用 Git 命令清单。几个专用名词的译名如下。

Workspace:工作区
Index / Stage:暂存区
Repository:仓库区(或本地仓库)
Remote:远程仓库

一、新建代码库

# 在当前目录新建一个Git代码库
$ git init

# 新建一个目录,将其初始化为Git代码库
$ git init [project-name]

# 下载一个项目和它的整个代码历史
$ git clone [url]

二、配置

Git的设置文件为.gitconfig,它可以在用户主目录下(全局配置),也可以在项目目录下(项目配置)。

# 显示当前的Git配置
$ git config --list

# 编辑Git配置文件
$ git config -e [--global]

# 设置提交代码时的用户信息
$ git config [--global] user.name "[name]"
$ git config [--global] user.email "[email address]"

三、增加/删除文件

# 添加指定文件到暂存区
$ git add [file1] [file2] ...

# 添加指定目录到暂存区,包括子目录
$ git add [dir]

# 添加当前目录的所有文件到暂存区
$ git add .

# 添加每个变化前,都会要求确认
# 对于同一个文件的多处变化,可以实现分次提交
$ git add -p

# 删除工作区文件,并且将这次删除放入暂存区
$ git rm [file1] [file2] ...

# 停止追踪指定文件,但该文件会保留在工作区
$ git rm --cached [file]

# 改名文件,并且将这个改名放入暂存区
$ git mv [file-original] [file-renamed]

四、代码提交

# 提交暂存区到仓库区
$ git commit -m [message]

# 提交暂存区的指定文件到仓库区
$ git commit [file1] [file2] ... -m [message]

# 提交工作区自上次commit之后的变化,直接到仓库区
$ git commit -a

# 提交时显示所有diff信息
$ git commit -v

# 使用一次新的commit,替代上一次提交
# 如果代码没有任何新变化,则用来改写上一次commit的提交信息
$ git commit --amend -m [message]

# 重做上一次commit,并包括指定文件的新变化
$ git commit --amend [file1] [file2] ...

五、分支

# 列出所有本地分支
$ git branch

# 列出所有远程分支
$ git branch -r

# 列出所有本地分支和远程分支
$ git branch -a

# 新建一个分支,但依然停留在当前分支
$ git branch [branch-name]

# 新建一个分支,并切换到该分支
$ git checkout -b [branch]

# 新建一个分支,指向指定commit
$ git branch [branch] [commit]

# 新建一个分支,与指定的远程分支建立追踪关系
$ git branch --track [branch] [remote-branch]

# 切换到指定分支,并更新工作区
$ git checkout [branch-name]

# 切换到上一个分支
$ git checkout -

# 建立追踪关系,在现有分支与指定的远程分支之间
$ git branch --set-upstream [branch] [remote-branch]

# 合并指定分支到当前分支
$ git merge [branch]

# 选择一个commit,合并进当前分支
$ git cherry-pick [commit]

# 删除分支
$ git branch -d [branch-name]

# 删除远程分支
$ git push origin --delete [branch-name]
$ git branch -dr [remote/branch]

六、标签

# 列出所有tag
$ git tag

# 新建一个tag在当前commit
$ git tag [tag]

# 新建一个tag在指定commit
$ git tag [tag] [commit]

# 删除本地tag
$ git tag -d [tag]

# 删除远程tag
$ git push origin :refs/tags/[tagName]

# 查看tag信息
$ git show [tag]

# 提交指定tag
$ git push [remote] [tag]

# 提交所有tag
$ git push [remote] --tags

# 新建一个分支,指向某个tag
$ git checkout -b [branch] [tag]

七、查看信息

# 显示有变更的文件
$ git status

# 显示当前分支的版本历史
$ git log

# 显示commit历史,以及每次commit发生变更的文件
$ git log --stat

$ git log -S [keyword]

# 显示某个commit之后的所有变动,每个commit占据一行
$ git log [tag] HEAD --pretty=format:%s

# 显示某个commit之后的所有变动,其"提交说明"必须符合搜索条件
$ git log [tag] HEAD --grep feature

# 显示某个文件的版本历史,包括文件改名
$ git log --follow [file]
$ git whatchanged [file]

# 显示指定文件相关的每一次diff
$ git log -p [file]

# 显示过去5次提交
$ git log -5 --pretty --oneline

# 显示所有提交过的用户,按提交次数排序
$ git shortlog -sn

# 显示指定文件是什么人在什么时间修改过
$ git blame [file]

# 显示暂存区和工作区的差异
$ git diff

# 显示暂存区和上一个commit的差异
$ git diff --cached [file]

# 显示工作区与当前分支最新commit之间的差异
$ git diff HEAD

# 显示两次提交之间的差异
$ git diff [first-branch]...[second-branch]

# 显示今天你写了多少行代码
$ git diff --shortstat "@{0 day ago}"

# 显示某次提交的元数据和内容变化
$ git show [commit]

# 显示某次提交发生变化的文件
$ git show --name-only [commit]

# 显示某次提交时,某个文件的内容
$ git show [commit]:[filename]

# 显示当前分支的最近几次提交
$ git reflog

八、远程同步

# 下载远程仓库的所有变动
$ git fetch [remote]

# 显示所有远程仓库
$ git remote -v

# 显示某个远程仓库的信息
$ git remote show [remote]

# 增加一个新的远程仓库,并命名
$ git remote add [shortname] [url]

# 取回远程仓库的变化,并与本地分支合并
$ git pull [remote] [branch]

# 上传本地指定分支到远程仓库
$ git push [remote] [branch]

# 强行推送当前分支到远程仓库,即使有冲突
$ git push [remote] --force

# 推送所有分支到远程仓库
$ git push [remote] --all

九、撤销

# 恢复暂存三区的指定文件到工作区
$ git checkout [file]

# 恢复某个commit的指定文件到暂存区和工作区
$ git checkout [commit] [file]

# 恢复暂存区的所有文件到工作区
$ git checkout .

# 重置暂存区的指定文件,与上一次commit保持一致,但工作区不变
$ git reset [file]

# 重置暂存区与工作区,与上一次commit保持一致
$ git reset --hard

# 重置当前分支的指针为指定commit,同时重置暂存区,但工作区不变
$ git reset [commit]

# 重置当前分支的HEAD为指定commit,同时重置暂存区和工作区,与指定commit一致
$ git reset --hard [commit]

# 重置当前HEAD为指定commit,但保持暂存区和工作区不变
$ git reset --keep [commit]

# 新建一个commit,用来撤销指定commit
# 后者的所有变化都将被前者抵消,并且应用到当前分支
$ git revert [commit]

# 暂时将未提交的变化移除,稍后再移入
$ git stash
$ git stash pop

十、其他

# 生成一个可供发布的压缩包
$ git archive