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

Re: Fetching SHA id's instead of named references?

From
Nicolas Pitre <nico@cam.org>
Date
Apr 8, 2009, 20:38 UTC
Message-ID
<alpine.LFD.2.00.0904081624410.6741@xanadu.home>
In-Reply-To
<4CBB910C-24F5-4F51-A02D-7760839CCE18@gmail.com>
On Wed, 8 Apr 2009, Klas Lindberg wrote:
Show 7 quoted lines
> 7 apr 2009 kl. 04.34 skrev Nicolas Pitre:
> 
> > In git terms, this is called "history rewriting".  And you really don't
> > want to do that if your repository is pulled by other people, unless
> > there is an explicit statement about that fact.
> 
> I thought you had to use filter-branch to qualify for history rewriting?

That, or 'git rebase', or 'git reset', or 'git commit --amend' on an already published commit, or reusing a branch name for a different line of development. Anything that would look like the past has changed to a client fetching from you.

> Anyway, the scenario I have in mind is when a new branch is created from the
> old one, the old one deleted and then the name of the old one gets reused. The
> deltas are still there, intact, but now you have to use a different named
> reference to reach them  :-(

Right. And normally you would use a good name for the new branch that clearly indicate its archiving purpose.

Show 11 quoted lines
> > Thing is, with the distributed nature of git, nothing prevents you from
> > keeping a local version of the commit you're interested in.  Unlike with
> > a central repository where someone else might delete a branch you need,
> > with git you will still have access to that particular commit locally
> > regardless if the remote repository has deleted it or not.
> 
> This is true, and Git is indeed very good at saving your ass on the client
> side. Other systems spend much more effort on saving your ass on the server
> side. My problem is that "my" people responsible for the overall system are
> mostly interested in the server side. At least that is where they put the
> tough requirements on perpetual availability.

Just never allow for any branch to be deleted nor rewound on the server then.

Show 7 quoted lines
> However, it is good enough if there is some way to somehow guarantee that a
> branch or tag will never be misused as outlined above. This could be solved
> through basic file system mechanisms (like write protecting the refs/tags
> files perhaps?) or a backup mechanism that raises an alarm on forbidden
> manipulations, or a host of other more or less weird mechanisms. Git doesn't
> have to provide the mechanism directly, but it would be nice for enterprise
> users if it did.
Git provides you with hooks.  Have a look here:
   http://www.kernel.org/pub/software/scm/git/docs/githooks.html
Nicolas
Previous: Klas Lindberg
Message 15 of 15 in “Fetching SHA id's instead of named references?”
  1. Klas LindbergApr 6, 2009
  2. Johannes SchindelinApr 6, 2009
  3. Klas LindbergApr 6, 2009
  4. Johannes SchindelinApr 6, 2009
  5. Dmitry PotapovApr 6, 2009
  6. Matthieu MoyApr 6, 2009
  7. Klas LindbergApr 6, 2009
  8. Finn Arne GangstadApr 6, 2009
  9. Shawn O. PearceApr 6, 2009
  10. Klas LindbergApr 6, 2009
  11. Nicolas PitreApr 6, 2009
  12. Klas LindbergApr 6, 2009
  13. Nicolas PitreApr 7, 2009
  14. Klas LindbergApr 8, 2009
  15. Nicolas PitreApr 8, 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.