看不懂 Dongsheng 的邮件是什么意思
再次强调：如果你的本地git版本库有修改时，请不要直接用"git pull"命令，而是要用： git fetch git rebase origin 这两个连续的命令，不然会出现令人恶心的merge提交，例如： http://repo.or.cz/w/i18n-zh.git?a=commit;h=51541cf1a5e4c3084bd0443edc8396509b4b850e Merge branch 'master' of git+ssh://firstname.lastname@example.org/srv/git/i18n-zh Dongsheng
author LI Daobing <email@example.com> Sun, 18 Nov 2007 04:37:16 +0000 (12:37 +0800) committer LI Daobing <firstname.lastname@example.org> Sun, 18 Nov 2007 04:37:16 +0000 (12:37 +0800) commit 51541cf1a5e4c3084bd0443edc8396509b4b850e tree fcfc7710988fe47ac48293471c4bfa7c530733c7 tree | snapshot parent 2942a23972538d3d575c2a4a9839e07f894d1a06 commit | diff parent 7e531f696ad7e49851a78053e3fe3b9596ed71e0 commit | diff Merge branch 'master' of git+ssh://email@example.com/srv/git/i18n-zh
- Why do my commit emails have extra "Merge branch 'master'" messages?
When you do a git pull, it fetches any changes to the upstream branches, merges them into your checkout, and does an auto-commit back to your local repo. This auto-commit produces this message, and it gets sent along when you push. Note that this commit only happens if you have commits in your local repository that haven't been pushed yet.
If you want to avoid this, you can "rebase" your branch instead of using "pull". Rebasing works by rewinding your working copy to the state of the remote branch, then replays all your changes on top of that.
$ git fetch
$ git rebase remotes/origin/
Obviously this can lead to conflicts similar to "git pull", but unlike pull, rebase will stop on each conflict. After resolving this conflict (editing files and running "git update-index" on them), "git rebase --continue" will continue the rebase. If you want to skip the conflicting commit, use "git rebase --skip". The whole rebase can be stopped and your branch restored to how it was by using "git rebase --abort".
根据 http://wiki.winehq.org/GitWine 只有提交 patch 或者希望更新本地文件为最新版本时，才需要 git rebase。根据 fd.o 一封邮件，“I wanted to commit a set of changes (4 local commits) upstream, so I had to do a git-rebase first (in that particular case a git-pull would have been possible as well, but git-rebase fits the CVS style development better).” 最后，由于 rebase 会改变历史，所以只能在本地使用：http://wincent.com/knowledge-base/Git_rebase_explained