Looker git version control: How to Revert to a specific commit in Looker, no git commands necessary

Looker git version control: How to Revert to a specific commit in Looker, no git commands necessary

  • Post category:Looker
  • Post last modified:February 5, 2023
  • Reading time:4 mins read

Looker git version control Prerequisites:

  • Must be on a version that supports advanced deploy and have it enabled
  • Your Looker instance must be accessible from the public internet, or you must be able to curl to the instance from command line
  • Must use a non-looker hosted repository which you have credentials to access

Solution:

1 – In Looker’s Project Settings, enable “Advanced Deploy” and set a Webhook Secret. Copy the secret, you will need it in step 3.

2 – In Your Git Provider: Find the specific commit you would like to revert to in the commit history of the Production Branch

Grab the commit SHA, eg e289a61, of the commit you would like to revert to. 

– Hit the SHA Advanced Deploy webhook using curl. 

curl -i -X POST -H "X-Looker-Deploy-Secret:<webhook_secret>" https://<instance.url.com>/webhooks/projects/<project_name>/deploy/ref/<ref_of_commit_to_revert_to>

How to calculate percent of total in looker?

– Re-enter Production in your project. Fin 🙂

Note: At this point, your local production code will now have been reverted to the specified commit. However, the `HEAD` of your remote production branch will have been unchanged. Thus, if you say, “Revert to Production” while in dev mode, your dev branch will pull from the faulty `HEAD` that you reverted in previous steps. To revert changes such that remote production’s `HEAD` is in sync with local production will require several additional steps, one of which will be to resolve a merge conflict:

5 – In your Git Provider, create a new branch from the specific commit you reverted local production to in steps 2-3

– In Looker, switch to that branch in the IDE, toggle Advanced Deploy OFF, and hit “Deploy to Production”. 

7 – You will now need to resolve a merge conflict

Source Ref-

About Me:-
I am Om Prakash Singh – Data Analytics Consultant , Looker Consultant , Solution Architect .
I am Highly analytical and process-oriented Data Analyst with in-depth knowledge of database types; research methodologies; and big data capture, manipulation and visualization. Furnish insights, analytics and business intelligence used to advance opportunity identification.

You’ve got data and lots of it. If you’re like most enterprises, you’re struggling to transform massive information into actionable insights for better decision-making and increased business results.
Reach out to us here if you are interested to evaluate if Looker is right for you or any other BI solution.

This Post Has 5 Comments

Leave a Reply