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

Re: [RFC] git-publish

From
Shawn Pearce <spearce@spearce.org>
Date
Aug 14, 2006, 01:51 UTC
Message-ID
<20060814015127.GA18667@spearce.org>
In-Reply-To
<Pine.LNX.4.64.0608131536590.9789@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> wrote:
Show 12 quoted lines
> On Sun, 13 Aug 2006, Sam Ravnborg wrote:
> 
> > But important note is that publishing is something I defer until some
> > limited test has been done. And when I omit that I have always ended u
> > pushing some crappy stuff that needs to be dealt with.
> 
> I also test before publishing. But I test before committing, too, because 
> I never get anything right (or even logically complete) the first time. My 
> cycle is edit/build/test, and if the test is successful, I commit and 
> push. Do other people really commit after editing each time? Or are they 
> testing before the commit, and doing more extensive testing after the 
> commit before the push?

I typically edit/commit/test, with a possible commit --amend after the test to fix whatever trivial bug came up during the test. But usually I get the initial edit right, so I don't --amend that often.

When building a patch series for core GIT I tend to make heavy use of git-format-pach and git-am; e.g. I'll edit/commit/test each change, then go back and do something like:

	git format-patch -o .. next
	git reset --hard next
	git am ../0003-*
	git am ../0001-*
	git am ../0002-*

or whatever to clean up my history before doing a final test and format-patch for emailing. The reason I do this is I tend to to pay attention to "patch size" when writing a change but I try to minimize the number of changed lines before submitting so the patch is cleaner. :-)

When I'm not hacking on core GIT I'm typically using `git push` to publish my changes to a common repository. In this case I still tend to commit before I test so I'd definately _not_ use a `git commit && git push` style of operation.

Although other SCMs (e.g. SVN or CVS) would encourage you to commit and push to the remote immediately this is actually a pretty bad idea in GIT.

If the remote is ahead of you then the push would automatically fail. If you are working on a team where everyone is doing `git commit && git push` then you will probably find that every other commit the remote is ahead of you, requiring you to pull first. But with CVS and SVN you usually don't run into that issue unless you touched the same files, and typically in that type of workflow users only edit "their" files so conflicts like that tend not to happen very often.

But even worse this style of workflow will generate a very messy history. Almost every commit will have been done in isolation, with yet another merge commit to connect it to the commit that beat it into the shared repository. This is not going to look very pretty in gitk.

So in my humble opinion I think this is not really a workflow style that should be encouraged with GIT. But perhaps tools to show you what would happen if you pushed right now (e.g. a shortlog of the commits that would upload or that must be downloaded and merged) would be useful.

-- 
Shawn.
Previous: Alex RiesenNext: Junio C Hamano
Message 10 of 14 in “[RFC] git-publish”
  1. Daniel BarkalowAug 13, 2006
  2. Junio C HamanoAug 13, 2006
  3. Johannes SchindelinAug 13, 2006
  4. Junio C HamanoAug 13, 2006
  5. Sam RavnborgAug 13, 2006
  6. Fredrik KuivinenAug 13, 2006
  7. Daniel BarkalowAug 13, 2006
  8. Sam RavnborgAug 13, 2006
  9. Alex RiesenAug 14, 2006
  10. Shawn PearceAug 14, 2006
  11. Junio C HamanoAug 14, 2006
  12. Jeff KingAug 14, 2006
  13. Martin LanghoffAug 13, 2006
  14. Petr BaudisSep 24, 2006

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.