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

Advice on strategy for "temporary" commits

From
DTDavid Tweed <david.tweed@gmail.com>
Date
Mar 11, 2007, 05:22 UTC
Message-ID
<e1dab3980703102122i398d1fa5ib4e629d32134f4e4@mail.gmail.com>
In-Reply-To
<e1dab3980703102101s21401403ja28c6273ecaa7b83@mail.gmail.com>
Show 6 quoted lines
> Try if "git checkout -m" does what you wanted. Or simply
> do a merge of "more often" branch into "less often" branch,
> perhaps simply not recording it as a merge with
> "git merge --squash" followed by "git commit".
>
> By the way, you know that you can --amend a commit?
Jakub suggested primarily being on the temporary branch,
when updating the archival branch is desired to first commit
to the temporary branch, then switch to the archival branch
and do a "git merge --squash temp-branch-name" and commit.
This seems to half-work, in that when it doesn't flag a merge
conflict it does what I want. Unfortunately it often seems to detect
"conflicts" that aren't conflicts for my usage and which make
automatic cron usage impossible, eg,
-------------------------------- 8< -------------------------------
$ git merge --squash temp
 100% (4/4) done
Auto-merged s
CONFLICT (content): Merge conflict in s
Squash commit -- not updating HEAD
Automatic merge failed; fix conflicts and then commit the result.

$ more s H1 t1 t2 <<<<<<< HEAD:s ======= t4 t5

>>>>>>> temp:s

--------------------------------- 8< ---------------------------- I _think_ if I could specify an opposite of the "ours" merge strategy that always takes file contents from the other branches head commit. An alternative might be to see if I can figure out directly commiting the relevant file tree to both branches using low-level git commands avoiding the higher level git processing (since this isn't really a merge of different development but recording the same "content state" on two different branches maybe trying to make a "merge" work is the wrong idea.)

[In case anyone thinks I'm wrong to want to work primarily from cron jobs, my rationale is that this stuff is personal to me -- ie, won't be independently changed by anyone else -- and isn't a focussed product. Years ago I tried using RCS on my home directory and found I spent lots of time writing contentless commit messages like "save at 11.15 on 05/06/02" and that during crunch periods I'd avoid making check-ins because it was too much extraneous work; but these were _precisely_ the times I'd be most likely to rush and do some stupid changes I'd want to back out, so it didn't really work and so I stopped using RCS. With my "safety net and historical archive" usage pattern -- which is different from productised development -- I really want something safe to run from cron.]

Anyway, thanks for all the help.
-- 
cheers, dave tweed__________________________
david.tweed@gmail.com
Rm 124, School of Systems Engineering, University of Reading.
Details are all that matters; God dwells there, and you never get to
see Him if you don't struggle to get them right. -- Stephen Jay Gould
Previous: Jakub Narebski
Message 7 of 7 in “Advice on strategy for "temporary" commits”
  1. David TweedMar 8, 2007
  2. Alex RiesenMar 8, 2007
  3. J. Bruce FieldsMar 8, 2007
  4. David TweedMar 8, 2007
  5. Mark WoodingMar 8, 2007
  6. Jakub NarebskiMar 9, 2007
  7. David TweedMar 11, 2007

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.