git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: question concerning branches

From
Andreas Ericsson <ae@op5.se>
Date
Aug 20, 2009, 07:33 UTC
Message-ID
<4A8CFC44.8050707@op5.se>
In-Reply-To
<4a8c4ece@wupperonline.de>
Ingo Brueckl wrote:
Show 25 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
>> This is one of the most useful features.
> 
> Wow. I'm sursprised to hear that, because I consider it at the moment as a
> very strange one.
> 
>> For example, it is an essential
>> part of supporting the workflow described here:
>>     http://gitster.livejournal.com/25892.html
> 
> Here is what I'd expect to do with git (described with my own words, not in
> git commands):
> 
> 1. commit the quick fix to the release branch
> 2. push this single commit to origin and master
> 
> Now that all branches have the commit a later push and pull should notice
> this and "skip" it.
> 
> This leads to a second question I have. Assuming I have three patches in my
> repo (#1, #2 and #3), is it possible to push only #2 (because it is a
> quick fix) and later, maybe after I committed #4, the rest, i.e. #1, #2 and
> #4?
> 

If they're on different branches, yes. If they're on the same branch, no. This is because a commit in git is named uniquely not only by its contents, but also by its ancestry.

You can, however, run "git rebase --interactive" and re-order the commits before you push them, so that #2 becomes #1 and vice versa. Then you can push only #1 (the old #2) while leaving #2 (the old #1), #3 and #4 on your machine only. This involves knowing the commit identifier of #1 though. Assuming it's "deadbeef", you can update the remote branch "foo" to hold your new commit by running the following command:

  git push <remote> deadbeef:refs/heads/foo
HTH
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Previous: Ingo Brueckl
Message 21 of 21 in “question concerning branches”
  1. Ingo BruecklAug 19, 2009
  2. Bruce StephensAug 19, 2009
  3. Avery PennarunAug 19, 2009
  4. Ingo BruecklAug 19, 2009
  5. Jakub NarebskiAug 19, 2009
  6. Ingo BruecklAug 19, 2009
  7. Avery PennarunAug 19, 2009
  8. Matthieu MoyAug 20, 2009
  9. Jacob HelwigAug 19, 2009
  10. Jakub NarebskiAug 19, 2009
  11. Theodore TsoAug 19, 2009
  12. Jakub NarebskiAug 19, 2009
  13. Theodore TsoAug 20, 2009
  14. Linus TorvaldsAug 19, 2009
  15. Randal L. SchwartzAug 20, 2009
  16. Ingo BruecklAug 20, 2009
  17. Johannes SixtAug 20, 2009
  18. Jakub NarebskiAug 20, 2009
  19. Junio C HamanoAug 19, 2009
  20. Ingo BruecklAug 19, 2009
  21. Andreas EricssonAug 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.