Skip to main content

Checking out an Existing Branch

You will always be on a “branch” - which is a current set of code for Calcs.com. Each branch is either a new segment of work or ‘master’, which is the code behind what’s currently in review (on preprod.calcs.com). In VSCode:
  1. Go to the git view (on the left sidebar, click the third icon down, which is in the shape of a ‘Y’)
  2. Under “Source Control Providers”, you’ll see “dev-environment” and, to the right of that, the branch that you’re currently on
  3. Click on that branch name, and select a new branch to change it
  4. Click on the circular arrow just to the right of the branch name to make sure you have all the latest work done in that branch

Creating a New Branch

Any time you start on a task which will make a complete work product, such as a single new sheet, or one major change to an existing sheet, you’ll create a new branch. In VSCode:
  1. In the git view, click on the current branch name
  2. Change to ‘master’, and then press the circular arrow to the right of the branch name (VITAL - ensures you’re starting from the most recent code)
  3. Click on the branch name again
  4. At the top of the list that pops up, click on “Create a new branch”
  5. Type in the name of your new branch, press ‘Enter’
  6. Click on the cloud button to the right of the branch name to also create the new branch on the server

Committing a Change

After you change a few things and save your file, you should ‘commit’ your changes. In VSCode:
  1. In the git view, on each file you want to commit, click the ”+” sign to stage your changes
  2. Write a description of your commit in the “Message” line at the top
  3. Either click the checkmark next to the branch name, or press Alt+Enter (⌘+Enter on Mac)
Nothing yet gets sent to the server when you commit - you need to push your changes!

Pushing Changes to the Server

Actually send your work to the server. This becomes both a backup and helps keep track of everything. In VSCode:
  • At the top of the git view, under “Source Control Providers”, you will see the name of the current branch you’re on
  • Click the circular arrow icon to the right of the branch name
  • This will ‘push’ all of your current commits to the server, as well as ‘pull’ anyone else’s updates to your local computer

The Ten Commandments of a Professional!

As you keep getting more and more experienced in programming, you get into the habit of minimizing the number of times that you switch between mouse and keyboard. VS Code offers you a long list of keyboard shortcuts to help you work more effectively with your keyboard.
Make sure that there are no conflicts between the shortcuts for VS Code and other software/applications on your OS. For example, the default combination for Loom to start recording a video happens to match with the shortcut for VS Code to select all instances of a string!

Top 10 Keyboard Shortcuts

  1. Reveal in Finder: option + command + R - Opens the folder for the current file
  2. Go to Symbol in Editor: shift + option + O - Bird’s eye view of variables, functions, symbols
  3. Go to Line: ctrl + G - Jump to specific line number
  4. Move Line Up/Down: option + up/down arrow
  5. Copy Line Up/Down: shift + option + up/down arrow
  6. Delete Current Line: shift + command + K
  7. Trigger Suggestions: ctrl + space
  8. Trigger Parameter Suggestions: shift + ctrl + space
  9. Select All Instances of Selected: shift + command + L
  10. Format Document: shift + option + F - Auto-format indentation
The same shortcuts also work on our JSON editor on Calcs.com since they use similar software.

Fixing Conflicts on VS Code

Video Tutorial: Fixing Conflicts