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

Re: [PATCH] GIT commit statistics.

From
Junio C Hamano <junkio@cox.net>
Date
Nov 13, 2005, 10:59 UTC
Message-ID
<7vy83s95k0.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<46a038f90511120419v70166c60t93d58b7544e03e3b@mail.gmail.com>
Martin Langhoff <martin.langhoff@gmail.com> writes:
> Similarly, when dealing with an upstream, my tree gets slowly out of
> sync and slightly messy. Eventually I get a new checkout, and rebase
> any pending patches with git-format-patch and git-am.

The key is not to let your tree go "slowly" out of sync, from my experience. When Linus was the maintainer, I used to do the equivalent of the following all the time to keep up with his tree while keeping my history clean [*1*].

Frequently [*2*], I tried to see if Linus made something new and interesting. My "origin" branch was always copy of Linus head.

	$ git fetch origin
The command would say "Fast forward".  So what did he do?
	$ git show-branch master origin
        ! [origin] Separate LDFLAGS and CFLAGS.
         * [master] Rename lost+found to lost-found.
        --
         + [master] Rename lost+found to lost-found.
         + [master^] Fix compilation warnings in pack-redundant.c
         + [master~2] Debian: build-depend on libexpat-dev.
        +  [origin] Separate LDFLAGS and CFLAGS.
        ++ [master~3] Split gitk into seperate RPM package

Ah, the commit master~3 was what he had the last time I pulled from him, and since then he made a commit while I did three. I could do "git pull . origin" at this point, but that would result in a useless mini-merge. My tree is not public so I can freely rebase to clean things up.

	$ git rebase origin
	$ git show-branch
        ! [origin] Separate LDFLAGS and CFLAGS.
         * [master] Rename lost+found to lost-found.
        --
         + [master] Rename lost+found to lost-found.
         + [master^] Fix compilation warnings in pack-redundant.c
         + [master~2] Debian: build-depend on libexpat-dev.
        ++ [origin] Separate LDFLAGS and CFLAGS.
Now I am fast-forward, so I could ask him to pull from me [*3*].

I think each of your developers can do the same, treating the "project shared repository" as "Linus repository" and pull that into the "origin" branch, and when the "master" is ready, push it back into the shared repository (which is equivalent of Linus pulling everything from me while doing nothing else in his repository).

For a sizable change that deserves a topic branch with a long sequence of commits, rebasing is not always the optimum solution; and you may want to keep the full merge history of such a branch pushed into the public repository as is. But for simpler cases that 'git rebase' can handle easily without conflicts, the above procedure would help you keeping the history of your shared repository less cluttered.

[Footnotes]

*1* Back then we did not have multi-head fetch, show-branch nor rebase, so I did these using a homebrew Porcelain.

*2* Unlike CVS which always mucks with the working tree, 'git fetch' into a branch that is not current one is an operation and can be done even when I am in the middle of a heavy hackery. Being able to peek into what others are up even when your tree is in a messy state (the fetch is often followed by log and diff) helps you to avoid doing duplicated work or going in a wrong direction, which was great.

*3* Even back then almost all changes were fed via e-mail to the maintainer.

Previous: Johannes SchindelinNext: Martin Langhoff
Message 48 of 58 in “Comments on recursive merge..”
  1. Linus TorvaldsNov 7, 2005
  2. Linus TorvaldsNov 7, 2005
  3. merge-recursive: Only print relevant rename messagesFredrik Kuivinen, Nov 7, 2005
  4. Junio C HamanoNov 7, 2005
  5. Fredrik KuivinenNov 9, 2005
  6. Fredrik KuivinenNov 7, 2005
  7. Junio C HamanoNov 8, 2005
  8. Linus TorvaldsNov 8, 2005
  9. Junio C HamanoNov 8, 2005
  10. Johannes SchindelinNov 8, 2005
  11. Fredrik KuivinenNov 8, 2005
  12. Junio C HamanoNov 8, 2005
  13. Linus TorvaldsNov 8, 2005
  14. Fredrik KuivinenNov 8, 2005
  15. Linus TorvaldsNov 8, 2005
  16. Johannes SchindelinNov 8, 2005
  17. Linus TorvaldsNov 9, 2005
  18. Junio C HamanoNov 9, 2005
  19. Petr BaudisNov 9, 2005
  20. Linus TorvaldsNov 9, 2005
  21. Junio C HamanoNov 9, 2005
  22. Linus TorvaldsNov 9, 2005
  23. Junio C HamanoNov 9, 2005
  24. Junio C HamanoNov 9, 2005
  25. Petr BaudisNov 9, 2005
  26. Linus TorvaldsNov 9, 2005
  27. Junio C HamanoNov 9, 2005
  28. Linus TorvaldsNov 9, 2005
  29. Junio C HamanoNov 9, 2005
  30. Linus TorvaldsNov 9, 2005
  31. merge-base: fully contaminate the well.Junio C Hamano, Nov 11, 2005
  32. Linus TorvaldsNov 11, 2005
  33. Junio C HamanoNov 11, 2005
  34. Linus TorvaldsNov 11, 2005
  35. Junio C HamanoNov 11, 2005
  36. Johannes SchindelinNov 8, 2005
  37. Make git-recursive the default strategy for git-pull.Junio C Hamano, Nov 8, 2005
  38. Junio C HamanoNov 11, 2005
  39. Linus TorvaldsNov 11, 2005
  40. Junio C HamanoNov 12, 2005
  41. Ryan AndersonNov 12, 2005
  42. GIT commit statistics.Junio C Hamano, Nov 12, 2005
  43. Martin LanghoffNov 12, 2005
  44. Petr BaudisNov 12, 2005
  45. Catalin MarinasNov 15, 2005
  46. Chuck LeverNov 15, 2005
  47. Johannes SchindelinNov 12, 2005
  48. Junio C HamanoNov 13, 2005
  49. Martin LanghoffNov 13, 2005
  50. Junio C HamanoNov 14, 2005
  51. Martin LanghoffNov 14, 2005
  52. Junio C HamanoNov 14, 2005
  53. Martin LanghoffNov 14, 2005
  54. Petr BaudisNov 14, 2005
  55. Martin LanghoffNov 14, 2005
  56. Junio C HamanoNov 14, 2005
  57. Junio C HamanoNov 15, 2005
  58. Petr BaudisNov 13, 2005

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.