Looker provides a development mode to allow model development in a safe environment that will not impact other users, until you are ready to deploy your changes.
Looker generally uses GitHub for LookML source code management. Some on-premise customers use other git solutions. Each LookML project corresponds with a Git repository. Looker uses Git to record changes and manage file versions.
Executing Git Commands in Looker
Looker has a built-in interface that allows you to execute Git commands. On the LookML page you’ll see a button in the upper left for Git.
There are three options for what the Git button will display, depending on the state of your development mode:
- Pull from Production will display if another developer has pushed new changes to production that have not yet been pulled into your development mode.
- Commit Changes will display if you have saved new changes.
- Push to Production will display if you have commited changes but not yet pushed them to production mode.
Git Dropdown Menu
The Git button has a dropdown menu, from which you can execute the following commands:
- Commit Changes records a snapshot of the model files in development mode
- View All Changes shows the difference between development mode and production for all files
- Git Status shows you the state of your project
- Pull fetches from production repository and merges it into your developer repository
- Push sends your new changes to the production repository
- Revert Uncommited Changes will revert all files in the repository to the state of the last commit
File-Specific Git Menu
There is also a Changes dropdown in the upper right, which appears after you have made changes to a file. From this dropdown you can execute the following commands for the current file:
- View Changes shows the difference between development mode and production for the current file
- Revert Changes will revert the current file to the state before the last commit
Updating the Development Model
The first thing you want to do when you start developing is to Pull from Production. This retrieves the most recent files from the production GitHub repository. While not strictly required, it is very useful and can help you avoid the need to resolve merge conflicts later.
If you do get a merge conflict, instructions to resolve it are found here.
Making Changes Live
Once you are satisfied that your changes are error-free and working as designed, you’re ready to push these changes to production. Pushing code from development to production requires three steps using the git interface:
- Commit Changes asks you to enter comments about the changes you are committing. Descriptive comments ensure easy troubleshooting later.
- Pull from Production is necessary if changes have been pushed to production by another developer since you last pulled.
- Push to Production deploys your code to production.
Checking the Impact of Your Changes
After making your changes available to the organization you can check to make sure you have not invalidated any saved Looks. You’ll have the oppotunity to fix them if you have.