Recommend to remove unused `origin` in a shared repository.
It is a common mistake to leave an unsed `origin` branch behind if a shared public repository was created by first cloning from somewhere else. Subsequent `git push` into it with the default "push all the matching ref" would push the `origin` branch from the developer repository uselessly. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jan 22, 2006 at 13:32 UTC
76b927f19f207b3f71b1c675bd75680aaedcb001
1 file changed
+20
Documentation/core-tutorial.txt
+20
@@ -1667,6 +1667,26 @@ complain, telling you that the remote `master` head does not
1667
fast forward. You need to pull and merge those other changes
1668
back before you push your work when it happens.
1669
1670
+The `git push` command without any explicit refspec parameter
1671
+pushes the refs that exist both in the local repository and the
1672
+remote repository. So the last `push` can be done with either
1673
+one of these:
1674
+------------
1675
+$ git push origin
1676
+$ git push repo.shared.xz:/pub/scm/project.git/
1677
+------------
1678
+as long as the shared repository does not have any branches
1679
+other than `master`.
1680
+[NOTE]
1681
+============
1682
+If you created your shared repository by cloning from somewhere
1683
+else, you may have the `origin` branch. Your developers
1684
+typically do not use that branch; remove it. Otherwise, that
1685
+would be pushed back by the `git push origin` because your
1686
+developers' repository would surely have `origin` branch to keep
1687
+track of the shared repository, and would be counted as "exist
1688
+on both ends".
1689
+============
1690
1691
Advanced Shared Repository Management
1692
-------------------------------------