Collaborate in a Git team project (pull, push)

Visual Studio 2013

When you collaborate on Team Foundation Server (TFS), your team uses version control integrated with other powerful capabilities such as planning and tracking projects and automated CI and scheduled builds. You can create a Git team project on either an on-premises server that you set up yourself, or on one that we maintain for you in the TFS cloud. Or, if you prefer, you can collaborate in remote Git repositories hosted by third-party services such as CodePlex, GitHub, or Bitbucket.

If you want to preview the changes from your team before you integrate them into your work, from the commits page (Keyboard: Ctrl + 0, O), fetch commits from your team project.

Fetch link on Commits page

After you fetch a commit, to get more information, open its context menu and choose View Commit Details.

Note Note

You must also fetch before you can get a copy of a branch that someone on your team has published.

When you are ready to integrate changes from your team into your local repository, in Team Explorer, go to the commits page (Keyboard: Ctrl + 0, O). Pull any commits that might have been pushed by your team.

Commits page with Fetch and Pull highlighted

If conflicts occur…

Conflicts sometimes occur when you try to pull

you must resolve them before you can proceed.

When you are ready to contribute your committed changes to the team’s remote Git repository, push them from the commits page (Keyboard: Ctrl + 0, O).

Pushing the commits
Note Note

You must pull remote changes before push

If your team has pushed commits to the branch since you last cloned or pushed, then you must first pull all the changes from the remote repository before you can push your changes into it.

In some cases, you might want to push to an alternate remote repository. (You must have installed Visual Studio 2013 Update 2 or a subsequent version to use this feature.)

For example, you are developing a web site in a Git team project. You want to publish the web site to Windows Azure, so you add your Windows Azure site as a remote repository. When you are ready to publish the site, you can push to it.

Push To link on Unsynced Commits page
Note Note

This option is available only in Visual Studio 2013 Update 2 and appears only if your Git repository has more than one remote. To add a remote, open the Git command prompt and then use the git remote command. See also: Git-SCM: Git Basics - Working with Remotes

To browse the team project, open it in your web browser (Keyboard: Ctrl + 0, A).

On the Home page, choose Web Access

Exploring a TFS Git repository in web access
  1. Explore the files

  2. View the commit history

  3. Work with branches

Before you explore the files, specify the branch or tag you want to use to filter the view.

You can filter the view by branch or by tag

On the Explorer page, browse the file tree and view each file. You can also see who changed what in each file.

Annotated changes to a file on web portal

You can also:

  • Get the URL to clone the repository. (You don’t need a URL to clone a repository from Visual Studio, but you might need it if you want to clone from the Command Prompt or from a third-party Git client tool.)

    Copying the URL to manually clone a repository in
  • Download an individual file and download a folder as a .zip file

  • Perform an Advanced search for a specific commit based on path, user (the author of the commit), and date

Do you want to be notified when someone pushes code into your Git team project? Subscribe to receive email alerts. Here’s how.

Alerts web portal page in Git team project

You can add additional repositories to your Git team project. Later, you can rename or delete them as needed. One benefit of working this way is that you can re-use process template customizations, such as those you’ve made to your work item type definitions, across multiple codebases.

To manage the Git repositories in your team project, open it in your web browser (Keyboard: Ctrl + 0, A).

Manage Git repositories

Create a new repository when you need one (for example, to develop a new app).

New repository link on version control web portal

In Visual Studio, select the repository in which you want to work.

Connect page, Git team project with multiple repos

A: One common reason Push is unavailable is if you are working in a branch that you have not yet published. Switch to the Branches page (Keyboard: Ctrl + 0, N) if you want to publish the branch.

This decision is subjective. Many people believe that you should keep each repository to a reasonable size. When the codebase grows to a certain point, they split it into multiple repositories. Some teams believe each app should have its own repository.

In general, you should avoid committing binaries, especially large ones. An alternative way to get binaries that your app depends on is to use NuGet.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft