ldrg
ldrg

Reputation: 4501

Why won't git push to a local repo update heads?

I've got a local repo upstream and a downstream cloned from it. upstream has a non-master branch called receiving I use for pushing (neither repo is bare).

When I do git push origin origin/receiving, git properly pushes the commit objects over but doesn't update the HEADs in upstream. I've actually fixed the issue before by opening the files in my editor and manually updating the hash. I'd still like to to know if there's something I could do to make it automatic. There aren't any permission issues - I'm actually doing everything as root with these repos.

Upvotes: 1

Views: 142

Answers (2)

knittl
knittl

Reputation: 265231

I think your push command is wrong. You want to push the local branch receiving (or whatever you call it:

git push origin receiving:receiving

This should definitely work, here's an example:

$ git init upstream
$ cd upstream
$ touch foo && git add foo && git commit -m 'initial'
$ git branch receiving
$ cd ..
$ git clone upstream downstream
$ cd downstream
$ >foo echo "downstream change" && git commit -am 'downstream'
$ git push origin master:receiving
$ cd ../upstream
$ git show receiving --
commit …
Author: …
Date:   Sun Feb 26 13:40:02 2012 +0100

    downstream

diff --git a/foo b/foo
index e69de29..2ba104f 100644
--- a/foo
+++ b/foo
@@ -0,0 +1 @@
+downstream change
$ git log --oneline --decorate --graph --all
* deadbeef (receiving) downstream
* c0ffee11 (HEAD, master) initial
$

Upvotes: 2

manojlds
manojlds

Reputation: 301147

You have to do git push origin receiving rather than git push origin origin/receiving

Upvotes: 0

Related Questions