Pull, commit, and push changes to a source code repository

To preserve the changes you make to your project, commit them to a local or remote source code repository. The changes you commit include updates to existing files, new files, and deleted files. For remote repositories, pull changes from others before you commit, and push changes after you commit.

If you are not using source control, either create a local source control repository or clone a project from a remote repository.

Pull changes from a remote repository

Pull changes from the remote repository to keep your working copy up to date with other changes to a branch. Also pull changes before you commit changes to avoid conflicts. If there are changes to pull, a down arrow and count appear next to the branch in the Source Control navigator.

  1. Choose Source Control > Pull.

  2. In the sheet that appears, choose a branch from the pop-up menu.

  3. Click Pull.

  4. Resolve differences by using the left and right buttons to specify which file’s contents to use.

  5. After reconciling all differences, click Pull to complete the operation.

Commit changes to a local or remote repository

WARNING: For remote repositories, pull changes before you commit changes; otherwise, you may not be able to complete the commit.

  1. Choose Source Control > Commit.

  2. In the sheet that appears, preview the changes.

    • To see changes to an individual file, select the file in the navigator and the comparison editor appears on the right.

    • To omit an edit to a file, click the marker in the gutter and choose Don’t Commit from the pop-up menu.

  3. Enter a description of the commit in the text field.

  4. For remote repositories, select “Push to remote” and if necessary, choose a remote repository from the adjacent pop-up menu.

    The changes will be pushed to the repository automatically after the commit. Alternatively, choose Source Control > Push later.

  5. Click Commit.

Push changes to a remote repository

If you don’t select “Push to remote” when you commit changes, you can push the commit later. If there are changes to push, an up arrow and count appear next to the branch in the Source Control navigator.

  1. Choose Source Control > Push.

  2. In the sheet that appears, choose a branch from the pop-up menu.

  3. Click Push.

To verify that changes were committed to a remote repository, Control-click the repository in the Source Control navigator or the commit in the history editor, and choose View on Host from the pop-up menu. The browser opens showing the commit page.

See alsoCreate a local source control repositoryClone a project from a remote source code repository