diff options
Diffstat (limited to 'Documentation/git-pull.txt')
-rw-r--r-- | Documentation/git-pull.txt | 70 |
1 files changed, 20 insertions, 50 deletions
diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index 7578623edb..31f42ea21a 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -13,19 +13,27 @@ SYNOPSIS DESCRIPTION ----------- -Runs 'git-fetch' with the given parameters, and calls 'git-merge' +Runs 'git fetch' with the given parameters, and calls 'git merge' to merge the retrieved head(s) into the current branch. -With `--rebase`, calls 'git-rebase' instead of 'git-merge'. +With `--rebase`, calls 'git rebase' instead of 'git merge'. Note that you can use `.` (current directory) as the <repository> to pull from the local repository -- this is useful when merging local branches into the current branch. -Also note that options meant for 'git-pull' itself and underlying -'git-merge' must be given before the options meant for 'git-fetch'. +Also note that options meant for 'git pull' itself and underlying +'git merge' must be given before the options meant for 'git fetch'. + +*Warning*: Running 'git pull' (actually, the underlying 'git merge') +with uncommitted changes is discouraged: while possible, it leaves you +in a state that is hard to back out of in the case of a conflict. OPTIONS ------- + +Options related to merging +~~~~~~~~~~~~~~~~~~~~~~~~~~ + include::merge-options.txt[] :git-pull: 1 @@ -47,6 +55,9 @@ unless you have read linkgit:git-rebase[1] carefully. --no-rebase:: Override earlier --rebase. +Options related to fetching +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + include::fetch-options.txt[] include::pull-fetch-param.txt[] @@ -131,58 +142,17 @@ $ git pull origin next ------------------------------------------------ + This leaves a copy of `next` temporarily in FETCH_HEAD, but -does not update any remote-tracking branches. - -* Bundle local branch `fixes` and `enhancements` on top of - the current branch, making an Octopus merge: -+ ------------------------------------------------- -$ git pull . fixes enhancements ------------------------------------------------- -+ -This `git pull .` syntax is equivalent to `git merge`. - -* Merge local branch `obsolete` into the current branch, using `ours` - merge strategy: +does not update any remote-tracking branches. Using remote-tracking +branches, the same can be done by invoking fetch and merge: + ------------------------------------------------ -$ git pull -s ours . obsolete +$ git fetch origin +$ git merge origin/next ------------------------------------------------ -* Merge local branch `maint` into the current branch, but do not make - a commit automatically: -+ ------------------------------------------------- -$ git pull --no-commit . maint ------------------------------------------------- -+ -This can be used when you want to include further changes to the -merge, or want to write your own merge commit message. -+ -You should refrain from abusing this option to sneak substantial -changes into a merge commit. Small fixups like bumping -release/version name would be acceptable. - -* Command line pull of multiple branches from one repository: -+ ------------------------------------------------- -$ git checkout master -$ git fetch origin +pu:pu maint:tmp -$ git pull . tmp ------------------------------------------------- -+ -This updates (or creates, as necessary) branches `pu` and `tmp` in -the local repository by fetching from the branches (respectively) -`pu` and `maint` from the remote repository. -+ -The `pu` branch will be updated even if it is does not fast-forward; -the others will not be. -+ -The final command then merges the newly fetched `tmp` into master. - If you tried a pull which resulted in a complex conflicts and -would want to start over, you can recover with 'git-reset'. +would want to start over, you can recover with 'git reset'. SEE ALSO |