git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pushing a branch without merging
@ 2011-06-20 14:11 Carlo Trimarchi
       [not found] ` <4DFF5B41.1000108@micronengineering.it>
  0 siblings, 1 reply; 4+ messages in thread
From: Carlo Trimarchi @ 2011-06-20 14:11 UTC (permalink / raw)
  To: git

Hi,
I'm managing a website with Git. I work on my local machine and push
changes to a bare git repository on a remote server. Then there there
is a hook to pull those changes in a directory with the live website.
I use the server only for the development version of the site and it
happens that when I'm working on a branch feature I want to show to
others what I'm doing.

So, on the local machine I can easily create a new branch, but I don't
know how to push what I modified in the new branch without affecting
the master branch.
What am I missing?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pushing a branch without merging
       [not found] ` <4DFF5B41.1000108@micronengineering.it>
@ 2011-06-20 14:56   ` Carlo Trimarchi
  2011-06-20 15:03     ` Carlos Martín Nieto
  0 siblings, 1 reply; 4+ messages in thread
From: Carlo Trimarchi @ 2011-06-20 14:56 UTC (permalink / raw)
  To: Massimo Manca, git

2011/6/20 Massimo Manca <massimo.manca@micronengineering.it>:

> then you edit and add files on the newly branch, so as usually you have
> to use:
>    git add .
>    git commit -m "what I change on this branch" -a
>
> When you have to update the remote then staying on experimental branch
> you can:
>    git push

This is exactly what I did, but on the server it showed the old version.
This is what appears when commiting:

➜  website git:(experimental) ✗ git commit -a -m "commit message"
[mario_style 7764c96] commit message
 2 files changed, 315 insertions(+), 204 deletions(-)
 rewrite index.html (88%)
➜  website git:(experimental) ✗ git push website
Counting objects: 7, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 451 bytes, done.
Total 4 (delta 2), reused 0 (delta 0)
To ssh://myserver.bla.com/home/user/website.git
   f93d62f..eb8e369  master -> master

I'm in the experimental branch, but in the end it shows master ->
master. Maybe that is what it is supposed to show, not sure.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pushing a branch without merging
  2011-06-20 14:56   ` Carlo Trimarchi
@ 2011-06-20 15:03     ` Carlos Martín Nieto
  2011-06-20 15:51       ` PJ Weisberg
  0 siblings, 1 reply; 4+ messages in thread
From: Carlos Martín Nieto @ 2011-06-20 15:03 UTC (permalink / raw)
  To: Carlo Trimarchi; +Cc: Massimo Manca, git

[-- Attachment #1: Type: text/plain, Size: 1838 bytes --]

On Mon, Jun 20, 2011 at 04:56:12PM +0200, Carlo Trimarchi wrote:
> 2011/6/20 Massimo Manca <massimo.manca@micronengineering.it>:
> 
> > then you edit and add files on the newly branch, so as usually you have
> > to use:
> >    git add .
> >    git commit -m "what I change on this branch" -a
> >
> > When you have to update the remote then staying on experimental branch
> > you can:
> >    git push
> 
> This is exactly what I did, but on the server it showed the old version.
> This is what appears when commiting:
> 
> ➜  website git:(experimental) ✗ git commit -a -m "commit message"
> [mario_style 7764c96] commit message
>  2 files changed, 315 insertions(+), 204 deletions(-)
>  rewrite index.html (88%)
> ➜  website git:(experimental) ✗ git push website
> Counting objects: 7, done.
> Delta compression using up to 8 threads.
> Compressing objects: 100% (4/4), done.
> Writing objects: 100% (4/4), 451 bytes, done.
> Total 4 (delta 2), reused 0 (delta 0)
> To ssh://myserver.bla.com/home/user/website.git
>    f93d62f..eb8e369  master -> master
> 
> I'm in the experimental branch, but in the end it shows master ->
> master. Maybe that is what it is supposed to show, not sure.

By default, git-push only pushes matching branches (those that exist
both in the local and remote repos). What you want to do might be

   git push website experimental

if you want to create the branch 'experimental', or if your deployment
system only checks out the 'master' branch, you might find

    git push website experimental:master

useful. In this case you may have to force-push master again, which is
not recommended (though in your case it might be fine). You can find
more details about how to specify which branches you want to push in
the git-push manpage.

Cheers,
   cmn

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pushing a branch without merging
  2011-06-20 15:03     ` Carlos Martín Nieto
@ 2011-06-20 15:51       ` PJ Weisberg
  0 siblings, 0 replies; 4+ messages in thread
From: PJ Weisberg @ 2011-06-20 15:51 UTC (permalink / raw)
  To: Carlos Martín Nieto
  Cc: Carlo Trimarchi, Massimo Manca, git@vger.kernel.org

On Monday, June 20, 2011, Carlos Martín Nieto <cmn@elego.de> wrote:

> if you want to create the branch 'experimental', or if your deployment
> system only checks out the 'master' branch, you might find
>
>     git push website experimental:master
>
> useful. In this case you may have to force-push master again, which is
> not recommended (though in your case it might be fine).

FYI, that *replaces* the remore master branch with the local
experimental branch.  If you just want someone else to be able to be
able to 'git pull website experimental', what you want to do is 'git
push website experimental' or 'git push website --all'.

-- 

-PJ

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-20 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-20 14:11 pushing a branch without merging Carlo Trimarchi
     [not found] ` <4DFF5B41.1000108@micronengineering.it>
2011-06-20 14:56   ` Carlo Trimarchi
2011-06-20 15:03     ` Carlos Martín Nieto
2011-06-20 15:51       ` PJ Weisberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).