24 linux git command-line
现在,我看到很多来自Linux Torvalds和/或Gitster的提交看起来像这样:
Merge branch 'maint' of git://github.com/git-l10n/git-po into maint …
* 'maint' of git://github.com/git-l10n/git-po:
l10n: de.po: fix a few minor typos
Run Code Online (Sandbox Code Playgroud)
要么:
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upst… …
…ream-linus
Pull MIPS update from Ralf Baechle:
...
* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (22 commits)
MIPS: SNI: Switch RM400 serial to SCCNXP driver
...
Run Code Online (Sandbox Code Playgroud)
我不知道怎么会这样做,虽然,我知道git remote和git checkout以及git merge我用来合并forks(或"pull requests")但它不会生成这样的消息,为什么?怎么会有人这样做(请提供例子)?
PS:我是Linus Torvalds提交的粉丝等,就像他的合并描述的详细程度一样; P
PS:这是我用来合并东西的方式:
git remote add anotherremoot
git checkout -b anotherbranch
git pull remoteshortcut
...do tests...
git checkout master
git merge anotherbranch
git push
Run Code Online (Sandbox Code Playgroud)
上面的例子我从以下网站获悉:http://viget.com/extend/i-have-a-pull-request-on-github-now-what
Bri*_*ell 39
只需使用git pull
将远程分支拉入master
:
git remote add something git://host.example.com/path/to/repo.git
git checkout master
git pull something master
Run Code Online (Sandbox Code Playgroud)
或者在不添加遥控器的情况下进行:
git pull git://host.example.com/path/to/repo.git
Run Code Online (Sandbox Code Playgroud)
git pull
获取远程分支,并将其合并到本地分支.如果可能,它会执行快进合并,这意味着它会将当前主服务器更新为最新提交,而不会生成合并提交.但如果双方都有变化,它会进行合并,就像你看到Linus和Junio所做的那样,包括远程URL.
如果你想保证你得到合并提交,即使它可以快进,也可以git pull -no-ff
.如果你想确保pull
永远不会创建合并提交(如果双方都有变化则失败),做git pull --ff-only
.
如果要包含更详细的消息,例如Linus提供的完整日志,请执行此操作git pull --log
.如果要编辑消息,请使用,而不是仅使用自动创建的消息git pull --edit
.有关更多选项,请参阅文档git pull
.