Re: pushing branches

2012-07-21 Thread Junio C Hamano
Thiago Farina tfrans...@gmail.com writes:

 Do'h, now I can see the idiocy that I was doing.

 If I'm understanding this better,
 $ git push origin master
 tells git to push to remote origin, the contents of my master branch.

Yes, add to the 'master' at the 'origin' at the end of the
sentence and you are perfect.

 And then,

 $ git push origin feature-work
 tells git to push to remote origin to push the contents of feature-work 
 branch.

Yes.

 Hence does not make sense to ask git to do push origin master while
 inside feature-work branch.

No.  As long as you know your master is ready and suitable to be
published when you ask push, the command perfectly makes sense; it
does not matter on what branch you are on.

You may say

$ git checkout master
... work work work ...
$ make test
... ahh, perfection! ...
$ git checkout -b feature
... let's build a bit more ..
... while I am having fun, let's not forget to push the
... part that is already solid out
$ git push origin master

and that is perfectly fine without git checkout master before
pushing (and git checkout feature after to come back to what you
were doing).
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pushing branches

2012-07-21 Thread Thiago Farina
On Sat, Jul 21, 2012 at 4:33 PM, Junio C Hamano gits...@pobox.com wrote:
 Yes.

 Hence does not make sense to ask git to do push origin master while
 inside feature-work branch.

 No.  As long as you know your master is ready and suitable to be
 published when you ask push, the command perfectly makes sense; it
 does not matter on what branch you are on.

 You may say

 $ git checkout master
 ... work work work ...
 $ make test
 ... ahh, perfection! ...
 $ git checkout -b feature
 ... let's build a bit more ..
 ... while I am having fun, let's not forget to push the
 ... part that is already solid out
 $ git push origin master

 and that is perfectly fine without git checkout master before
 pushing (and git checkout feature after to come back to what you
 were doing).
In my case it wouldn't because I do not modify my master branch, I
just fetch upstream, merge upstream/master into my local master branch
and switch to feature-work, then git push origin master will always
give me Everything up-to-date I suppose (that is what always happen
in my case/workflow).

And just learned, the answer to my question is, while in feature-work
branch, 'git push origin feature-work'. Which does what I wanted.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pushing branches

2012-07-20 Thread Thiago Farina
Hi,

How can I push a working branch to github inside it?

E.g:

# On master:
$ git checkout -b feature-work

# On feature-work
# vi, hack, commit, ready to push
$ git push origin master # here I expected it would working pushing my
commits to a feature-work branch in github. Or if I omit master it
gives me a [rejected] error.
Everything up-to-date.

$ git checkout master
$ git push origin feature-work # Now the branch is pushed.

Thanks,
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pushing branches

2012-07-20 Thread Junio C Hamano
Thiago Farina tfrans...@gmail.com writes:

 How can I push a working branch to github inside it?

 E.g:

 # On master:
 $ git checkout -b feature-work

 # On feature-work
 # vi, hack, commit, ready to push
 $ git push origin master # here I expected it would working pushing my

git push origin master is a short-hand for git push origin
refs/heads/master:refs/heads/master to update their master branch
with what you have in your master branch. 

See output from

$ git push --help

for details.

I think you are trying to update, while on your feature-work branch,
their master with your feature-work branch (or more generally, the
current HEAD), so

$ git push origin HEAD:master

is perhaps what you are looking for?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pushing branches

2012-07-20 Thread PJ Weisberg
On Fri, Jul 20, 2012 at 8:26 AM, Thiago Farina tfrans...@gmail.com wrote:
 Hi,

 How can I push a working branch to github inside it?

 E.g:

 # On master:
 $ git checkout -b feature-work

 # On feature-work
 # vi, hack, commit, ready to push
 $ git push origin master # here I expected it would working pushing my
 commits to a feature-work branch in github. Or if I omit master it
 gives me a [rejected] error.
 Everything up-to-date.

 $ git checkout master
 $ git push origin feature-work # Now the branch is pushed.

???

I must be missing something.  It looks like the reason it didn't push
feature-work the first time is because you told it to push master
instead.

-PJ

Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pushing branches

2012-07-20 Thread Konstantin Khomoutov
On Fri, 20 Jul 2012 12:26:09 -0300
Thiago Farina tfrans...@gmail.com wrote:

 How can I push a working branch to github inside it?
 
 E.g:
 
 # On master:
 $ git checkout -b feature-work
 
 # On feature-work
 # vi, hack, commit, ready to push
 $ git push origin master # here I expected it would working pushing my
 commits to a feature-work branch in github. Or if I omit master it
 gives me a [rejected] error.
$ git push origin master
means update the branch 'master' in the remote repository with the
contents of the branch 'master' in the local repository.
Read the git push manual.

 $ git checkout master
 $ git push origin feature-work # Now the branch is pushed.
Sure, but it has nothing to do with the previous checkout command: you
just told Git to push the contents of your local branch feature-work
to a remote branch feature-work which presumably does not exist and
gets created as a result of your push.

If you want to update the remote master branch with the contents of
your local feature-work branch, do
$ git push origin feature-work:master

As stated below, you should really read the git push manual and reading
through the appropriate sections of the http://git-scm.com/book is also
highly advised.

Also consider reading about the push.default configuration variable
in the git config manual--this might save you from scratching your head
when you try to do simple `git push origin` without specifying any
branches: here again your expectation might differ from the Git
defaults.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pushing branches

2012-07-20 Thread Thiago Farina
On Fri, Jul 20, 2012 at 12:46 PM, Junio C Hamano gits...@pobox.com wrote:
 Thiago Farina tfrans...@gmail.com writes:

 How can I push a working branch to github inside it?

 E.g:

 # On master:
 $ git checkout -b feature-work

 # On feature-work
 # vi, hack, commit, ready to push
 $ git push origin master # here I expected it would working pushing my

 git push origin master is a short-hand for git push origin
 refs/heads/master:refs/heads/master to update their master branch
 with what you have in your master branch.

 See output from

 $ git push --help

 for details.

 I think you are trying to update, while on your feature-work branch,
 their master with your feature-work branch (or more generally, the
 current HEAD), so

 $ git push origin HEAD:master

 is perhaps what you are looking for?

What I'm looking for is to upload/create the remote branch in github
from inside my local branch, without having to checkout master in
order to do so.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pushing branches

2012-07-20 Thread Matthieu Moy
Thiago Farina tfrans...@gmail.com writes:

 $ git push origin master # here I expected it would working pushing my
 commits to a feature-work branch in github. Or if I omit master it
 gives me a [rejected] error.
 Everything up-to-date.

If your workflow is to push one branch at a time, and you have the same
naming locally and remotely (i.e. your local branch feature-work should
be pushed as feature-work on github), then you probably want to set the
variable 'push.default' to either 'current', 'upstream' or 'simple' if
you use the last version of Git. Read about it there:

  http://git-scm.com/docs/git-config

(search push.default)

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pushing branches

2012-07-20 Thread Thiago Farina
On Fri, Jul 20, 2012 at 4:19 PM, PJ Weisberg
p...@irregularexpressions.net wrote:
 On Fri, Jul 20, 2012 at 8:49 AM, Thiago Farina tfrans...@gmail.com wrote:

 What I'm looking for is to upload/create the remote branch in github
 from inside my local branch, without having to checkout master in
 order to do so.

 In that case, do exactly what you did, except don't checkout master.

Why you suggest that? If I demonstrated that origin master or just
origin in the current branch doesn't do what I want, i.e, push it to
github.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pushing branches

2012-07-20 Thread PJ Weisberg
On Fri, Jul 20, 2012 at 6:40 PM, Thiago Farina tfrans...@gmail.com wrote:
 On Fri, Jul 20, 2012 at 4:19 PM, PJ Weisberg
 p...@irregularexpressions.net wrote:
 On Fri, Jul 20, 2012 at 8:49 AM, Thiago Farina tfrans...@gmail.com wrote:

 What I'm looking for is to upload/create the remote branch in github
 from inside my local branch, without having to checkout master in
 order to do so.

 In that case, do exactly what you did, except don't checkout master.

 Why you suggest that? If I demonstrated that origin master or just
 origin in the current branch doesn't do what I want, i.e, push it to
 github.

In your original email, you had one command that did what you wanted
and one that didn't.

$ git push origin master
$ git push origin feature-work

Can you spot the difference between them?

Like Konstantin said, you can look into the different options for
push.default, but don't expect Git to push one branch when you told it
to push another.

-PJ

Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html