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:- Go to the git view (on the left sidebar, click the third icon down, which is in the shape of a ‘Y’)
- Under “Source Control Providers”, you’ll see “dev-environment” and, to the right of that, the branch that you’re currently on
- Click on that branch name, and select a new branch to change it
- 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:- In the git view, click on the current branch name
- 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)
- Click on the branch name again
- At the top of the list that pops up, click on “Create a new branch”
- Type in the name of your new branch, press ‘Enter’
- 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:- In the git view, on each file you want to commit, click the ”+” sign to stage your changes
- Write a description of your commit in the “Message” line at the top
- 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.Top 10 Keyboard Shortcuts
- Mac
- Windows
- Reveal in Finder:
option + command + R- Opens the folder for the current file - Go to Symbol in Editor:
shift + option + O- Bird’s eye view of variables, functions, symbols - Go to Line:
ctrl + G- Jump to specific line number - Move Line Up/Down:
option + up/down arrow - Copy Line Up/Down:
shift + option + up/down arrow - Delete Current Line:
shift + command + K - Trigger Suggestions:
ctrl + space - Trigger Parameter Suggestions:
shift + ctrl + space - Select All Instances of Selected:
shift + command + L - Format Document:
shift + option + F- Auto-format indentation