Skip to content

Commit 76b927f

Browse files
author
Junio C Hamano
committed
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>
1 parent 927a503 commit 76b927f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Documentation/core-tutorial.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,26 @@ complain, telling you that the remote `master` head does not
16671667
fast forward. You need to pull and merge those other changes
16681668
back before you push your work when it happens.
16691669

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+
============
16701690

16711691
Advanced Shared Repository Management
16721692
-------------------------------------

0 commit comments

Comments
 (0)