Project

General

Profile

Revision Control - Merging Master Changes

WARNING: Make sure you commit any changes before doing this.

On a regular basis (every few days, at most a week) you should merge the changes in the master version of the project back into your working copy so your code will be updated with any bug fixes or other improvements made to the master.

Your changes will NOT be lost. Updating your copy does not overwrite your code with a newer version from the server. It intelligently merges the code from the master version and your version. Most of the time it can be done automatically. If there are "conflicts" - changes to exactly the same section of the code - you will need to manually fix the conflicts.

It's important to update your code regularly because the longer you wait, the more changes are made to the master version and the less likely you'll be able to merge the changes automatically.

From Command Line

  1. IN the top level directory of your project update your local copy of the master code from the server
    % git pull origin master
     
  2. Merge the master changes into your working version
    % git merge --no-ff master
  • If there are no conflicts the code will be merged and the new merged version committed.
  • If there are conflicts both versions of the code will be saved into the file. There are a few ways to deal with the conflicts:
    • Edit the file in RStudio and resolve the conflicts.
       
    • At the command line run the graphical git merge tool
      % git mergetool
  • After the conflicts are resolved commit the changes.

In RStudio you can checkout the Git - History tab to see the changes to the code.