{"thread":{"id":"24240","subject":"How to Push a range of commits.","startedAt":"2010-06-30T05:51:01Z","lastAt":"2010-06-30T13:47:58Z","messageCount":2,"participants":["Mahesh Vaidya","Ramkumar Ramachandra"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"144501","messageId":"AANLkTikOffJHjzd3iBOXm7Lt7uPzHGkR1kfWtxSd-F9S@mail.gmail.com","threadId":"24240","inReplyTo":null,"subject":"How to Push a range of commits.","fromName":"Mahesh Vaidya","fromEmail":"forvaidya@gmail.com","sentAt":"2010-06-30T05:51:01Z","receivedAt":"2010-06-30T05:51:01Z","isPatch":false,"sender":{"key":"forvaidya@gmail.com","avatar":null},"body":"On branch 'foobar' I have a range of contiguous  commits  say C1...C9,\nC1 being at HEAD / TOP.\n\nIf I push branch all 9 commits will make it to authoritative\nrepository.  Is there a way to push a single commit (as C9 or C10 new\ncommit) which is common change set between C1 .. C9\n\n-- \nThank You\n-Mahesh,\n"},{"id":"144515","messageId":"20100630134758.GC30999@debian","threadId":"24240","inReplyTo":"AANLkTikOffJHjzd3iBOXm7Lt7uPzHGkR1kfWtxSd-F9S@mail.gmail.com","subject":"Re: How to Push a range of commits.","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-06-30T13:47:58Z","receivedAt":"2010-06-30T13:47:58Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Mahesh,\n\nMahesh Vaidya writes:\n> On branch 'foobar' I have a range of contiguous  commits  say C1...C9,\n> C1 being at HEAD / TOP.\n> \n> If I push branch all 9 commits will make it to authoritative\n> repository.  Is there a way to push a single commit (as C9 or C10 new\n> commit) which is common change set between C1 .. C9\n\nDo you want to squash all the commits into one commit and push that?\nIf so, use the interactive rebase to squash them into one commit (in\npossibly another branch) and push that commit.\n\nIf you want to push just a few commits instead, create a new branch\nbased on upstream, cherry-pick the commits you want into it and push\nit to the upstream branch. For example, if I have a branch `foo`\ntracking the upstream `origin/foo` and is ahead of the upstream by 10\ncommits, but I only want to push commit `bar`:\n\n$ # In branch foo\n$ git checkout moo # New temporary branch\n$ git reset --hard origin/foo # Base it on upstream\n$ git cherry-pick bar\n$ git push origin +refs/heads/moo:refs/heads/foo\n$ # I think the \"refs/heads\" part can be omitted in the above command\n\n-- Ram\n"}]}