Tobi
Tobi

Reputation: 1312

GIT: get only Commit Text, Branches and some special files

I want to write a simple application to track the bugs, todos and some other information just within my git repos (so anyone that develops at that projects have always the list of todos with them)

Therefor I add some files to each of my git repos: .git-bugs .git-todos .git-after-checkout etc. Also The users have a special way to form the commit messages.

Now I want to write a litte php app (or any other language), that just readout the commit messages and the contents of the above mentioned files (and perhaps a list, which files are changed at each commit) without checking out the complete repo.

Is there any way? If not is there any way to just checkout the repo, but not the files, so just the commit-messages?

Upvotes: 1

Views: 239

Answers (1)

Peter Lundgren
Peter Lundgren

Reputation: 9217

You can only browse the history of a Git repository locally. Some services will offer an API to do such things remotely, but fundamentally they are just forwarding you the results of running Git commands on the server.

You can clone a repository without a working tree with:

git clone --bare <repository>

However, this will not save you any bandwidth; it still has to clone the repository. It will save you the disk space for the checked out files if that's important for you. You can then see the contents of a file without checking it out with:

git show <revision>:<file>
git show master:.git-bugs

You can get a log with a list of changed files with:

git log --name-only

There are a number of log options that provide more information as well. git log --stat for example. See git-log(1) for more information.

Upvotes: 1

Related Questions