{"thread":{"id":"27664","subject":"pushing a branch without merging","startedAt":"2011-06-20T14:11:28Z","lastAt":"2011-06-20T15:51:36Z","messageCount":4,"participants":["Carlo Trimarchi","Carlos Martín Nieto","PJ Weisberg"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"170297","messageId":"BANLkTin4fpwX9NgnP0U1+z9tRA=akR6MDg@mail.gmail.com","threadId":"27664","inReplyTo":null,"subject":"pushing a branch without merging","fromName":"Carlo Trimarchi","fromEmail":"mr.spoon21@gmail.com","sentAt":"2011-06-20T14:11:28Z","receivedAt":"2011-06-20T14:11:28Z","isPatch":false,"sender":{"key":"mr.spoon21@gmail.com","avatar":"https://gravatar.com/avatar/dd14cc2f79de3b58a3301a3b6f5ea4f0e72c79172d1dc919eb08016830e57c9e?d=mp&s=160"},"body":"Hi,\nI'm managing a website with Git. I work on my local machine and push\nchanges to a bare git repository on a remote server. Then there there\nis a hook to pull those changes in a directory with the live website.\nI use the server only for the development version of the site and it\nhappens that when I'm working on a branch feature I want to show to\nothers what I'm doing.\n\nSo, on the local machine I can easily create a new branch, but I don't\nknow how to push what I modified in the new branch without affecting\nthe master branch.\nWhat am I missing?\n"},{"id":"170299","messageId":"BANLkTikWDzZD8b-aUMXJwByeN3tBsYipgQ@mail.gmail.com","threadId":"27664","inReplyTo":"4DFF5B41.1000108@micronengineering.it","subject":"Re: pushing a branch without merging","fromName":"Carlo Trimarchi","fromEmail":"mr.spoon21@gmail.com","sentAt":"2011-06-20T14:56:12Z","receivedAt":"2011-06-20T14:56:12Z","isPatch":false,"sender":{"key":"mr.spoon21@gmail.com","avatar":"https://gravatar.com/avatar/dd14cc2f79de3b58a3301a3b6f5ea4f0e72c79172d1dc919eb08016830e57c9e?d=mp&s=160"},"body":"2011/6/20 Massimo Manca <massimo.manca@micronengineering.it>:\n\n> then you edit and add files on the newly branch, so as usually you have\n> to use:\n>    git add .\n>    git commit -m \"what I change on this branch\" -a\n>\n> When you have to update the remote then staying on experimental branch\n> you can:\n>    git push\n\nThis is exactly what I did, but on the server it showed the old version.\nThis is what appears when commiting:\n\n➜  website git:(experimental) ✗ git commit -a -m \"commit message\"\n[mario_style 7764c96] commit message\n 2 files changed, 315 insertions(+), 204 deletions(-)\n rewrite index.html (88%)\n➜  website git:(experimental) ✗ git push website\nCounting objects: 7, done.\nDelta compression using up to 8 threads.\nCompressing objects: 100% (4/4), done.\nWriting objects: 100% (4/4), 451 bytes, done.\nTotal 4 (delta 2), reused 0 (delta 0)\nTo ssh://myserver.bla.com/home/user/website.git\n   f93d62f..eb8e369  master -> master\n\nI'm in the experimental branch, but in the end it shows master ->\nmaster. Maybe that is what it is supposed to show, not sure.\n"},{"id":"170300","messageId":"20110620150303.GA2782@bee.lab.cmartin.tk","threadId":"27664","inReplyTo":"BANLkTikWDzZD8b-aUMXJwByeN3tBsYipgQ@mail.gmail.com","subject":"Re: pushing a branch without merging","fromName":"Carlos Martín Nieto","fromEmail":"cmn@elego.de","sentAt":"2011-06-20T15:03:03Z","receivedAt":"2011-06-20T15:03:03Z","isPatch":false,"sender":{"key":"cmn@elego.de","avatar":"https://avatars.githubusercontent.com/u/335443?v=4"},"body":"On Mon, Jun 20, 2011 at 04:56:12PM +0200, Carlo Trimarchi wrote:\n> 2011/6/20 Massimo Manca <massimo.manca@micronengineering.it>:\n> \n> > then you edit and add files on the newly branch, so as usually you have\n> > to use:\n> >    git add .\n> >    git commit -m \"what I change on this branch\" -a\n> >\n> > When you have to update the remote then staying on experimental branch\n> > you can:\n> >    git push\n> \n> This is exactly what I did, but on the server it showed the old version.\n> This is what appears when commiting:\n> \n> ➜  website git:(experimental) ✗ git commit -a -m \"commit message\"\n> [mario_style 7764c96] commit message\n>  2 files changed, 315 insertions(+), 204 deletions(-)\n>  rewrite index.html (88%)\n> ➜  website git:(experimental) ✗ git push website\n> Counting objects: 7, done.\n> Delta compression using up to 8 threads.\n> Compressing objects: 100% (4/4), done.\n> Writing objects: 100% (4/4), 451 bytes, done.\n> Total 4 (delta 2), reused 0 (delta 0)\n> To ssh://myserver.bla.com/home/user/website.git\n>    f93d62f..eb8e369  master -> master\n> \n> I'm in the experimental branch, but in the end it shows master ->\n> master. Maybe that is what it is supposed to show, not sure.\n\nBy default, git-push only pushes matching branches (those that exist\nboth in the local and remote repos). What you want to do might be\n\n   git push website experimental\n\nif you want to create the branch 'experimental', or if your deployment\nsystem only checks out the 'master' branch, you might find\n\n    git push website experimental:master\n\nuseful. In this case you may have to force-push master again, which is\nnot recommended (though in your case it might be fine). You can find\nmore details about how to specify which branches you want to push in\nthe git-push manpage.\n\nCheers,\n   cmn"},{"id":"170304","messageId":"BANLkTik8j1g6wqeD7oGQra1Ep10uaTH0Rg@mail.gmail.com","threadId":"27664","inReplyTo":"20110620150303.GA2782@bee.lab.cmartin.tk","subject":"Re: pushing a branch without merging","fromName":"PJ Weisberg","fromEmail":"pjweisberg@gmail.com","sentAt":"2011-06-20T15:51:36Z","receivedAt":"2011-06-20T15:51:36Z","isPatch":false,"sender":{"key":"pjweisberg@gmail.com","avatar":"https://gravatar.com/avatar/e585568071f361126c42f73b11bee72fc6d4bdfea34be29faa52e621da3517eb?d=mp&s=160"},"body":"On Monday, June 20, 2011, Carlos Martín Nieto <cmn@elego.de> wrote:\n\n> if you want to create the branch 'experimental', or if your deployment\n> system only checks out the 'master' branch, you might find\n>\n>     git push website experimental:master\n>\n> useful. In this case you may have to force-push master again, which is\n> not recommended (though in your case it might be fine).\n\nFYI, that *replaces* the remore master branch with the local\nexperimental branch.  If you just want someone else to be able to be\nable to 'git pull website experimental', what you want to do is 'git\npush website experimental' or 'git push website --all'.\n\n-- \n\n-PJ\n"}]}