2

My context is the following:

  • I want to do some operations on Git, that are only possible on a local repository.
  • I don't care about the content of history, even the current content. Only the metadata (commits, authors, dates, ...) are from interest.

So I would like to have a local Git repository that contains the least amount of data, to allow operations like:

  • Do a branch, and push it.
  • Do a tag, and push it.

Is something like that possible at all? I know already what a bare repository is (it gives you all commits including the file data), and I have read about git shallow clone, but both give me with the commits all data.

mliebelt
  • 15,345
  • 7
  • 55
  • 92
  • 4
    Saying "I don't care about the content of history" followed by "Only...commits...are from interest" doesn't make any sense. Git commits *are* the history. – larsks Dec 08 '17 at 13:50
  • What is the point of branching if you don't plan on changing source code files? – Tim Biegeleisen Dec 08 '17 at 13:50
  • 2
    A branch always refers to a commit and a tag needs an git object. They can't exist alone. – ElpieKay Dec 08 '17 at 13:53
  • 2
    I'm not sure as what your asking is pretty unclear to me but I *think* you might be talking about a [bare repository](https://stackoverflow.com/a/28428742/542251) – Liam Dec 08 '17 at 14:02
  • What does _"only possible on a local repository"_ mean? git is a **D**VCS. – evolutionxbox Dec 08 '17 at 14:55
  • Looks like we should unmark this as a dupe; I hadn't noticed that you already excluded a bare repo as the solution (and don't know much about those). – underscore_d Dec 08 '17 at 17:19

1 Answers1

2

No, what you are asking (to have commits without the actual content) is fundamentally not supported by git. Depending how your remote is hosted, the hosting server might provide API's that you could use to manipulate refs (branches and tags) without having to clone, but that's about it.

Mark Adelsberger
  • 42,148
  • 4
  • 35
  • 52