{"thread":{"id":"27842","subject":"How to push the very last modification only ?","startedAt":"2011-07-18T07:47:30Z","lastAt":"2011-07-19T06:07:58Z","messageCount":4,"participants":["J. Bakshi","Chris Packham","Drew Northup"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171546","messageId":"20110718131730.4898ddaf@shiva.selfip.org","threadId":"27842","inReplyTo":null,"subject":"How to push the very last modification only ?","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-18T07:47:30Z","receivedAt":"2011-07-18T07:47:30Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"Hello list,\n\nI have found that during push, all local commit goes into the git server. Where I like to only push the very last modification with a meaningful comment which will be available at the git server. How can I then push only the last modified one ?\n\nThanks\n"},{"id":"171564","messageId":"4E23F5CB.3090009@gmail.com","threadId":"27842","inReplyTo":"20110718131730.4898ddaf@shiva.selfip.org","subject":"Re: How to push the very last modification only ?","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2011-07-18T08:58:51Z","receivedAt":"2011-07-18T08:58:51Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"Hi,\n\nOn 18/07/11 19:47, J. Bakshi wrote:\n> Hello list,\n> \n> I have found that during push, all local commit goes into the git \n> server.\n\nYes that's the normal behaviour. When you think about what push is doing\nit's trying to make the remote branch the same as your local branch.\n\n> Where I like to only push the very last modification with\n> a meaningful comment which will be available at the git server. How\n> can I then push only the last modified one ?\n\nThis is easily doable. What you need to do is prepare a branch that you\ndo want to push. Something like this, assuming that your current branch\nis 'master' and you want to push to origin/master:\n\n  # first create temporary a branch to use while you're delivering\n  git checkout -b delivery origin/master\n\n  # now cherry pick the commits you do want to push. I usually use\n  # gitk and cherry-pick from the right-click menu, but for simplicity\n  # I'll use git cherry-pick here.\n  git cherry-pick master\n  # you can provide a commit id instead of 'master'.\n\n  # at this point you could also use git commit --amend to add any\n  # final tweaks to the commit\n\n  # check that your delivery branch is good using git log/gitk. Build,\n  # test, etc\n\n  # now push it to your local delivery branch to the remote master\n  # branch\n  git push origin delivery:master\n\n  # now do some cleanup\n  git checkout master\n  git branch -d delivery\n  git rebase origin/master\n"},{"id":"171587","messageId":"1311007753.18654.32.camel@drew-northup.unet.maine.edu","threadId":"27842","inReplyTo":"4E23F5CB.3090009@gmail.com","subject":"Re: How to push the very last modification only ?","fromName":"Drew Northup","fromEmail":"drew.northup@maine.edu","sentAt":"2011-07-18T16:49:13Z","receivedAt":"2011-07-18T16:49:13Z","isPatch":false,"sender":{"key":"drew.northup@maine.edu","avatar":"https://avatars.githubusercontent.com/u/18331571?v=4"},"body":"\nOn Mon, 2011-07-18 at 20:58 +1200, Chris Packham wrote:\n> Hi,\n> \n> On 18/07/11 19:47, J. Bakshi wrote:\n> > Hello list,\n> > \n> > I have found that during push, all local commit goes into the git \n> > server.\n> \n> Yes that's the normal behaviour. When you think about what push is doing\n> it's trying to make the remote branch the same as your local branch.\n> \n> > Where I like to only push the very last modification with\n> > a meaningful comment which will be available at the git server. How\n> > can I then push only the last modified one ?\n> \n> This is easily doable. What you need to do is prepare a branch that you\n> do want to push. Something like this, assuming that your current branch\n> is 'master' and you want to push to origin/master:\n<snip>\n\nAnother way to do what Chris describes is to use Interactive Rebase (git\nrebase -i) to squash commits together. Please read the manual page for\nthat carefully before using it on a production repository.\n-- \n-Drew Northup\n________________________________________________\n\"As opposed to vegetable or mineral error?\"\n-John Pescatore, SANS NewsBites Vol. 12 Num. 59\n"},{"id":"171639","messageId":"20110719113758.3099f220@shiva.selfip.org","threadId":"27842","inReplyTo":"4E23F5CB.3090009@gmail.com","subject":"Re: How to push the very last modification only ?","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-19T06:07:58Z","receivedAt":"2011-07-19T06:07:58Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"On Mon, 18 Jul 2011 20:58:51 +1200\nChris Packham <judge.packham@gmail.com> wrote:\n\n> Hi,\n> \n> On 18/07/11 19:47, J. Bakshi wrote:\n> > Hello list,\n> > \n> > I have found that during push, all local commit goes into the git \n> > server.\n> \n> Yes that's the normal behaviour. When you think about what push is doing\n> it's trying to make the remote branch the same as your local branch.\n> \n> > Where I like to only push the very last modification with\n> > a meaningful comment which will be available at the git server. How\n> > can I then push only the last modified one ?\n> \n> This is easily doable. What you need to do is prepare a branch that you\n> do want to push. Something like this, assuming that your current branch\n> is 'master' and you want to push to origin/master:\n> \n>   # first create temporary a branch to use while you're delivering\n>   git checkout -b delivery origin/master\n> \n>   # now cherry pick the commits you do want to push. I usually use\n>   # gitk and cherry-pick from the right-click menu, but for simplicity\n>   # I'll use git cherry-pick here.\n>   git cherry-pick master\n>   # you can provide a commit id instead of 'master'.\n> \n>   # at this point you could also use git commit --amend to add any\n>   # final tweaks to the commit\n> \n>   # check that your delivery branch is good using git log/gitk. Build,\n>   # test, etc\n> \n>   # now push it to your local delivery branch to the remote master\n>   # branch\n>   git push origin delivery:master\n> \n>   # now do some cleanup\n>   git checkout master\n>   git branch -d delivery\n>   git rebase origin/master\n> \n> \n\nIt works !! Many many thanks :-)\n"}]}