1

I am using Git for source code version control in TFS 2013.

I need to programmatically connect to the Git master repository on TFS server using TFS API or others to list all the commits instead of listing from a cloned local repository.

Is there anyone able to enlighten on this? Thanks very much.

juvchan
  • 6,113
  • 2
  • 22
  • 35
  • Do you really need *all* the commits, or would you be happy with just the references (branches and tags) and their associated commit IDs? – jub0bs Sep 02 '14 at 11:11
  • Closely related: http://stackoverflow.com/questions/1178389/browse-and-display-files-in-a-git-repo-without-cloning – jub0bs Sep 02 '14 at 11:16
  • Thanks @Jubobs! I need the commits instead of just the references from the remote repository. – juvchan Sep 03 '14 at 03:26

1 Answers1

0

Git is a distributed system. The only thing that makes a particular repo the "master" is that you and the others accessing it regard it as such. So the way to ask about remote changes is to retrieve a copy of them locally. So figure out what remote corresponds to the server in question: it might be "origin" or "tfs" or whatever.

git fetch [REMOTE_NAME]
### or just
git fetch --all
### then
git log --pretty=oneline [REMOTE_NAME]/[BRANCH_NAME]

For every locally tracked branch the corresponding remote branch state is maintained under the remote/branch namespace.

Joe Atzberger
  • 3,079
  • 1
  • 18
  • 16