As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Version control/advanced

From sasCommunity
Jump to: navigation, search
This is a work in progress. You can contribute to this article.

This page chronicles advanced version control concepts and techniques. While some may come in handy in everyday work, they go beyond the list explained on the version control page.

Replacing local changes

  • checkout - in Subversion,[1] this is essentially the same as a git clone. In git, this can be used to bring down the copy of a code file in a repository, overwriting the local copy.[2] Code:
git checkout -- <file> for all files
git checkout * for all files


This is not the same as data step merging.

Merging refers to resolution when multiple users (or the same user in multiple branches) bring changes back to the same base commit. For example, this may happen if you attempt to push commits without having updated your local copy of code.

In some cases, more advanced resolution techniques may be needed. For example, if you see the following:

error: your local changes to the following files would be overwritten by merge:
        <list of files>
please, commit your changes or stash them before you can merge

In this case, there are several options that the user may take.[3] (See other methods for what to do in Subversion.)

One option is to stash your changes.[4] Essentially, this pushes your local changes onto a stash stack, so you can pull from the remote repository as if you hadn't made the changes. Then you can pop the stack to bring your changes back. Code:

git stash save --keep-index
(perform pull from remote, etc.)
git stash apply (or use methods for specifying a stash or converting a stash into a branch)

You can also drop the stash if you don't want to save the changes.

git stash drop

Other commands

The default/standard name used to identify your remote repository is origin. You may recognize this from running commands such as git push origin master.

However, you can specify any name you want to identify the remote. If you run git remote, you can see the name of any remote(s) currently setup.[5]

Further issues

If you have an issue with you version control system, Google it. Someone has probably had the same or a very similar issue in the past. If you can't find something, ask on Stack Overflow.

Code Review

Best practice in software development involves incorporating code review into the development process. Team members will review each others' commits and comment and ask questions based on what they see. Benefits include:

  • better conforming to your organization's coding standards
  • having multiple sets of eyes can catch things like bugs or unexpected use cases
  • team bonding and learning from each others' experiences
  • oversight of those with domain knowledge

While this can be done in a team meeting setting, it can also be done individually through software tools. Code review software can be integrated with version control and issue tracking software, which can enable linking from commit messages to the relevant issue(s) and/or code review discussion.