From: Oleg Broytman Date: Fri, 26 Jun 2015 23:26:59 +0000 (+0300) Subject: Add more details about fetch/pull/push X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=8617b1d5a3acbba9017d75afb7891b994368b368;p=git-wiki.git Add more details about fetch/pull/push --- diff --git a/pep-git.txt b/pep-git.txt index 3158a4a..8f5d8f2 100644 --- a/pep-git.txt +++ b/pep-git.txt @@ -200,8 +200,8 @@ and The first command fetches commits from the named BRANCH in the REMOTE repository that are not in your repository and leaves the id (the -hash) of the head commit in file .git/FETCH_HEAD. But it doesn't -update any branch (doesn't move any pointer). +hash) of the head commit in file .git/FETCH_HEAD and +updates remote-tracking branch. The second command fetches commits from the named BRANCH in the REMOTE repository that are not in your repository and updates both the local @@ -258,6 +258,10 @@ or even $ git pull +Default remote repository for fetching/pulling is origin. Default set +of references to fetch is calculated using matching algorithm: git +fetches all branches having the same name on both ends. + Push '''' @@ -268,9 +272,8 @@ run $ git push origin v1 v2 -git guesses (knowing upstream remote branches) that you really want - -:: +git pushes local v1 to remote v1 and local v2 to remote v2. The same +as:: $ git push origin v1:v1 v2:v2 @@ -297,6 +300,21 @@ or even $ git push +Default remote repository for pushing is origin. Default set +of references to push in git before 2.0 is calculated using matching +algorithm: git pushes all branches having the same name on both ends. +Default set of references to push in git 2.0+ is calculated using +simple algorithm: git pushes the current branch back to its +@{upstream}. + +To configure git before 2.0 to the new behaviour run:: + +$ git config push.default simple + +To configure git 2.0+ to the old behaviour run:: + +$ git config push.default matching + Git refuses to push a branch if it's the current branch in the remote non-bare repository: git refuses to update remote working directory. You really should push only to bare repositories. For non-bare