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

Re: [PATCH 10/10] push: teach push to be quiet if local ref is strict subset of remote ref

From
Steffen Prohaska <prohaska@zib.de>
Date
Nov 1, 2007, 16:43 UTC
Message-ID
<3550D197-CA8C-4B06-9A95-3C7F18EBEFA7@zib.de>
In-Reply-To
<47299855.9010204@op5.se>
On Nov 1, 2007, at 10:11 AM, Andreas Ericsson wrote:
Show 27 quoted lines
> Steffen Prohaska wrote:
>> On Oct 31, 2007, at 10:31 PM, Junio C Hamano wrote:
>>> Steffen Prohaska <prohaska@zib.de> writes:
>>>
>>>> Another difference is the way changes are integrated. In
>>>> a workflow without shared repositories, only pull is used
>>>> for integration, while push in only used for publishing the
>>>> changes.
>>>
>>> Wrong.  push is a mirror of fetch and does not do _any_
>>> integration.  It is just a safe (because it insists on
>>> fast-forward) propagation mechanism.  Your integration still
>>> happens with pull (actually, shared repository people seem to
>>> prefer "fetch + rebase" over "pull" which is "fetch + merge").
>> Right; but you can't push without doing the integration. If you
>> have new changes on the remote side you _must_ pull before
>> you can push.
>
> Yes, because otherwise you'd rewrite published history. That's not
> a good thing.
>
>> You're forced to do the integration immediately.
>
> Yes, but you get to choose how. Perhaps git-push should list more
> options than just git-pull, such as the three commands required to
> rebase the currently checked out branch onto its remote counterpart.
> That would support more workflows.
I agree. Providing better hints would be good.
Show 5 quoted lines
>> Your main objective was to push, but the shared workflow forces
>> you to do the integration _now_ (by using pull). In a pull-only
>> workflow, you can just push and defer the integration for later.
>
> No, you can also fetch + rebase.

Right. My point was than one cannot defer the integration. It must be addressed immediately.

Show 15 quoted lines
>> Some people claim fetch + rebase is superior to fetch + merge.
>> The only point I can see is that fetch + rebase gives a linear
>> history without loops, which is nicer to visualize. I recently
>> asked on the list if there are any benefits of fetch + rebase
>> over fetch + merge, besides a nicer visualization.
>
>
> It's easier to bisect. If git bisect lands you on a merge-commit,
> you need to start a new bisect for each of the parents included
> in the merge. Hopefully the nature of the merge gives a clue so
> the user can make an educated guess as to which parent introduced
> the bogus commit, but for an "evil octopus" (unusual) or if the
> merge had conflicts which were resolved in a buggy way (not
> exactly uncommon), it can be quite a hassle to get things right.
> With a mostly linear history, this problem goes away.

This is really an interesting point. I did not start to use git bisect regularly. But I certainly plan to do so in the future.

Couldn't bisect learn to better cope with non-linear history?
[...]
Show 8 quoted lines
>> I am searching for a solution that just works for them. They
>> currently use CVS. I'll give them a detailed getting started
>> document for git. The workflow described should be as simple as
>> possible, but safe and reliable.
>
>
> If they're used to CVS and want to use more than one branch without
> having to learn additional syntax, nothing can help, methinks.

They will learn. But they must not get frustrated too early. I also don't wont to see them lining up in front of my office.

BTW, what do you thing about the proposal to add branch.$name.push [1]?
[1] http://marc.info/?l=git&m=119384331712996&w=2
[...]
Show 9 quoted lines
>> There were different suggestions what to do. A reasonable
>> suggestion was to delete the local branch after you're done.
>
> Except that it doesn't work unless you either detach the HEAD
> (which prints a big fat ugly message) or give it -D to force
> it, which I really, really don't recommend. We use git because
> I'm pretty confident in its capabilities of never ever losing
> anything. Using the seemingly harmless -D switch to git-branch
> puts us at risk of wiping history quite without noticing.

I don't like -D either. I liked the idea mentioned recently to check -d against the remotes. If a remote tracking branch has the history it should be considered fully merged.

Another idea may be to distinguish between detached head and checkout of remote tracking branch. Maybe we could do some useful things if get knew that the user is 'on a remote tracking branch'. Committing could be forbidden. A suggestion would be printed instead to use "git checkout -b something", which could act as if the remote branch was mentioned on the command line.

Something like that would be needed before I'd seriously suggest to delete local branches after you finished your work.

Show 15 quoted lines
>> This clearly distinguishes between remote branches (which are
>> mirrored as a remote tracking branch) and local branches. Local
>> branches are _your_ branches while the remote branches contain
>> the shared work. If you're done with your local work, delete
>> your local branch. So maybe you should do
>>    git checkout origin/devel
>
> Except that this gives a warning-esque message:
> Note: moving to "origin/devel" which isn't a local branch
> If you want to create a new branch from this checkout, you may do so
> (now or later) by using -b with the checkout command again. Example:
>  git checkout -b <new_branch_name>
> HEAD is now at deadbeef... Ma! Pa butchered all the cows!
>
> To me, this indicates I've done something git thinks I shouldn't have.

I agree. This could probably be suppressed if git handled remote tracking branches a bit differently from other detached heads.

Show 6 quoted lines
>> Independently of what the best practice is, leaving the local
>> work branch there shouldn't do any harm because I'm sure that
>> some devs will forget to clean up, independently of what I tell
>> them.
>
> I wholeheartedly agree with this one.
So I think we need to resolve this first.

Do you already have post-checkout script that makes useful suggestions. I remember you mentioned something like that during the 200-local-branches discussion.

	Steffen
Previous: Andreas EricssonNext: Junio C Hamano
Message 26 of 53 in “improve refspec handling in push”
  1. 0/10 improve refspec handling in pushSteffen Prohaska, Oct 28, 2007
  2. 01/10 push: change push to fail if short refname does not existSteffen Prohaska, Oct 28, 2007
  3. 02/10 push: teach push new flag --createSteffen Prohaska, Oct 28, 2007
  4. 03/10 push: support pushing HEAD to real branch nameSteffen Prohaska, Oct 28, 2007
  5. 04/10 push: add "git push HEAD" shorthand for 'push current branch to default repo'Steffen Prohaska, Oct 28, 2007
  6. 05/10 rename ref_matches_abbrev() to ref_abbrev_matches_full_with_fetch_rules()Steffen Prohaska, Oct 28, 2007
  7. 06/10 add ref_abbrev_matches_full_with_rev_parse_rules() comparing abbrev with full ref nameSteffen Prohaska, Oct 28, 2007
  8. 07/10 push: use same rules as git-rev-parse to resolve refspecsSteffen Prohaska, Oct 28, 2007
  9. 08/10 push: teach push to accept --verbose optionSteffen Prohaska, Oct 28, 2007
  10. 09/10 push: teach push to pass --verbose option to transport layerSteffen Prohaska, Oct 28, 2007
  11. 10/10 push: teach push to be quiet if local ref is strict subset of remote refSteffen Prohaska, Oct 28, 2007
  12. Junio C HamanoOct 30, 2007
  13. Steffen ProhaskaOct 30, 2007
  14. Andreas EricssonOct 30, 2007
  15. Steffen ProhaskaOct 30, 2007
  16. Junio C HamanoOct 30, 2007
  17. Steffen ProhaskaOct 31, 2007
  18. Junio C HamanoOct 31, 2007
  19. Junio C HamanoOct 31, 2007
  20. Steffen ProhaskaOct 31, 2007
  21. Junio C HamanoOct 31, 2007
  22. Steffen ProhaskaOct 31, 2007
  23. Junio C HamanoOct 31, 2007
  24. Steffen ProhaskaNov 1, 2007
  25. Andreas EricssonNov 1, 2007
  26. Steffen ProhaskaNov 1, 2007
  27. Junio C HamanoNov 1, 2007
  28. Steffen ProhaskaNov 2, 2007
  29. Junio C HamanoNov 2, 2007
  30. Steffen ProhaskaNov 2, 2007
  31. Junio C HamanoNov 2, 2007
  32. Steffen ProhaskaNov 2, 2007
  33. Andreas EricssonNov 2, 2007
  34. Tom PrinceNov 2, 2007
  35. Andreas EricssonNov 2, 2007
  36. Steffen ProhaskaNov 2, 2007
  37. Junio C HamanoNov 2, 2007
  38. Junio C HamanoNov 2, 2007
  39. Andreas EricssonNov 1, 2007
  40. Steffen ProhaskaNov 1, 2007
  41. Andreas EricssonNov 1, 2007
  42. Wincent ColaiutaNov 2, 2007
  43. Johannes SchindelinNov 2, 2007
  44. Steffen ProhaskaNov 2, 2007
  45. Wincent ColaiutaNov 2, 2007
  46. Daniel BarkalowOct 30, 2007
  47. Junio C HamanoOct 30, 2007
  48. Steffen ProhaskaOct 30, 2007
  49. Junio C HamanoOct 30, 2007
  50. Junio C HamanoOct 30, 2007
  51. Junio C HamanoOct 30, 2007
  52. Steffen ProhaskaOct 30, 2007
  53. Junio C HamanoOct 30, 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.