“How to submit a git pull request”的版本间的差异
来自百问网嵌入式Linux wiki
(创建页面,内容为“Category:How_toCategory:Git”) |
Zhouyuebiao(讨论 | 贡献) |
||
(未显示同一用户的1个中间版本) | |||
第1行: | 第1行: | ||
+ | {{DISPLAYTITLE:如何提交git pull请求}} | ||
+ | |||
+ | : git pull 命令的作用是,取回远程主机某个分支的更新,再与本地的指定分支合并。它的完整格式稍稍有点复杂。 | ||
+ | : 我们可以使用 git pull -h 来查看帮助信息。 | ||
+ | <syntaxhighlight lang# "bash"> | ||
+ | book@www.100ask.org:~/tmp/Embedded-Linux-ADCMSE$ git pull -h | ||
+ | usage: git pull [<options>] [<repository> [<refspec>...]] | ||
+ | |||
+ | -v, --verbose be more verbose | ||
+ | -q, --quiet be more quiet | ||
+ | --progress force progress reporting | ||
+ | |||
+ | Options related to merging | ||
+ | -r, --rebase[=<false|true|preserve>] | ||
+ | incorporate changes by rebasing rather than merging | ||
+ | -n do not show a diffstat at the end of the merge | ||
+ | --stat show a diffstat at the end of the merge | ||
+ | --log[=<n>] add (at most <n>) entries from shortlog to merge commit message | ||
+ | --squash create a single commit instead of doing a merge | ||
+ | --commit perform a commit if the merge succeeds (default) | ||
+ | --edit edit message before committing | ||
+ | --ff allow fast-forward | ||
+ | --ff-only abort if fast-forward is not possible | ||
+ | --verify-signatures verify that the named commit has a valid GPG signature | ||
+ | -s, --strategy <strategy> | ||
+ | merge strategy to use | ||
+ | -X, --strategy-option <option=value> | ||
+ | option for selected merge strategy | ||
+ | -S, --gpg-sign[=<key-id>] | ||
+ | GPG sign commit | ||
+ | |||
+ | Options related to fetching | ||
+ | --all fetch from all remotes | ||
+ | -a, --append append to .git/FETCH_HEAD instead of overwriting | ||
+ | --upload-pack <path> path to upload pack on remote end | ||
+ | -f, --force force overwrite of local branch | ||
+ | -t, --tags fetch all tags and associated objects | ||
+ | -p, --prune prune remote-tracking branches no longer on remote | ||
+ | --recurse-submodules[=<on-demand>] | ||
+ | control recursive fetching of submodules | ||
+ | --dry-run dry run | ||
+ | -k, --keep keep downloaded pack | ||
+ | --depth <depth> deepen history of shallow clone | ||
+ | --unshallow convert to a complete repository | ||
+ | --update-shallow accept refs that update .git/shallow | ||
+ | --refmap <refmap> specify fetch refmap | ||
+ | |||
+ | book@www.100ask.org:~/tmp/Embedded-Linux-ADCMSE$ | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | : 一般我们使用到的命令格式是: | ||
+ | git pull <远程主机名> <远程分支名>:<本地分支名> | ||
+ | = 常用的命令 = | ||
+ | : 取回 origin 主机的next分支,与本地的 master 分支合并 | ||
+ | git pull origin next:master | ||
+ | : 如果远程分支是与当前分支合并,则冒号后面的部分可以省略: | ||
+ | git pull origin next | ||
+ | : 如果当前分支与远程分支存在追踪关系,git pull 就可以省略远程分支名。 | ||
+ | git pull origin | ||
+ | : 当前分支只有一个追踪分支,默认当前分支自动与唯一一个追踪分支进行合并,连远程主机名都可以省略, | ||
+ | git pull | ||
+ | : 如果合并需要使用 rebase 模式,可以使用 –rebase 选项: | ||
+ | git pull --rebase <远程主机名> <远程分支名>:<本地分支名> | ||
+ | |||
+ | |||
[[Category:How_to]][[Category:Git]] | [[Category:How_to]][[Category:Git]] |
2020年1月10日 (五) 15:43的最新版本
- git pull 命令的作用是,取回远程主机某个分支的更新,再与本地的指定分支合并。它的完整格式稍稍有点复杂。
- 我们可以使用 git pull -h 来查看帮助信息。
book@www.100ask.org:~/tmp/Embedded-Linux-ADCMSE$ git pull -h
usage: git pull [<options>] [<repository> [<refspec>...]]
-v, --verbose be more verbose
-q, --quiet be more quiet
--progress force progress reporting
Options related to merging
-r, --rebase[=<false|true|preserve>]
incorporate changes by rebasing rather than merging
-n do not show a diffstat at the end of the merge
--stat show a diffstat at the end of the merge
--log[=<n>] add (at most <n>) entries from shortlog to merge commit message
--squash create a single commit instead of doing a merge
--commit perform a commit if the merge succeeds (default)
--edit edit message before committing
--ff allow fast-forward
--ff-only abort if fast-forward is not possible
--verify-signatures verify that the named commit has a valid GPG signature
-s, --strategy <strategy>
merge strategy to use
-X, --strategy-option <option=value>
option for selected merge strategy
-S, --gpg-sign[=<key-id>]
GPG sign commit
Options related to fetching
--all fetch from all remotes
-a, --append append to .git/FETCH_HEAD instead of overwriting
--upload-pack <path> path to upload pack on remote end
-f, --force force overwrite of local branch
-t, --tags fetch all tags and associated objects
-p, --prune prune remote-tracking branches no longer on remote
--recurse-submodules[=<on-demand>]
control recursive fetching of submodules
--dry-run dry run
-k, --keep keep downloaded pack
--depth <depth> deepen history of shallow clone
--unshallow convert to a complete repository
--update-shallow accept refs that update .git/shallow
--refmap <refmap> specify fetch refmap
book@www.100ask.org:~/tmp/Embedded-Linux-ADCMSE$
- 一般我们使用到的命令格式是:
git pull <远程主机名> <远程分支名>:<本地分支名>
常用的命令
- 取回 origin 主机的next分支,与本地的 master 分支合并
git pull origin next:master
- 如果远程分支是与当前分支合并,则冒号后面的部分可以省略:
git pull origin next
- 如果当前分支与远程分支存在追踪关系,git pull 就可以省略远程分支名。
git pull origin
- 当前分支只有一个追踪分支,默认当前分支自动与唯一一个追踪分支进行合并,连远程主机名都可以省略,
git pull
- 如果合并需要使用 rebase 模式,可以使用 –rebase 选项:
git pull --rebase <远程主机名> <远程分支名>:<本地分支名>