There is an excellent adapter for git <--> tfs interaction. It is called git-tfs. Using this I could use my favorite git efficiently. Once I am done with my work I could push to tfs. This gist explains the steps I followed and brief git tfs command reference.
Run the below as Admin
C:\> @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://bit.ly/psChocInstall'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
C:\> cinst GitTfs # this takes a lot of time. at some point one dialog box is displayed and
# all the applications are closed. But it gets completed.
Whenever there is an interaction with tfs, instead of using usual git commands like git pull
, use git tfs
commands.
D:\> git tfs quick-clone http://inspexes3atsrv:8080/tfs/defaultcollection $/GUIATPs/SmartUITest
- quick-clone doesn't pull the whole list of history. it should be enough.
- if we make quick-clone to clone, it takes forever. but it does the job.
- if for some reason it fails (e.g. connectivity to tfs is lost), we have to clean up the directory and try again from the beginning.
Don't use git pull. instead...
git tfs pull
Following things work as usual
git log
git status
git add .
git commit -a -m 'commit to local'
git branch
git branch -r # note the remote branch is not called as origin/master. it is tfs/default.
git diff tfs/default master
Quick way to checkin, but can't specify additional info such as code reviewer
git tfs checkin -m 'Did stuff'
If you prefer to checkin with the usual tfs checkin dialog (which also provides options such as diffing the files, addressing conflicts, adding code reviewer, etc)
git tfs checkintool
git tfs shelve A_SHELVESET_NAME
git tfs shelve-list
git tfs unshelve A_SHELVESET_NAME