saurabh18cs
Honored Contributor III

Hi @damirg same question what @pradeep_singh has but if you still want to proceed with this way then try out this:

 NOTE:: 1) Rename the attach file extension to .py
2) change SSS to your foldername within databricks workspace/Repos/<<foldername>>/<<reponame>>
 
See if you can use this to change your branch, This has more methods but use what you need
 
Pseudocode below (modify just for your usecase):
  repo_url, repo_name, branch_name = get_repo_info()
  repo_config = get_repo_config(repo_name, branch_name, repo_url)
  print(json.dumps(repo_config, indent=2))

  repo_exists = get_existing_repo(databricks_url, databricks_token, repo_name)
  print(json.dumps(repo_exists, indent=2) if repo_exists else "Repo does not exist")

  if repo_exists:
      repo_id = repo_exists.get('id')
      if not repo_id:
          print("Repo Id is null")
          exit(1)
      else:
          update_repo(databricks_url, databricks_token, repo_id, repo_config)
          print(f"Repository {repo_name} updated.")
  else:
      create_workspace_directory(databricks_workspace_url, databricks_token)
      repo_id = create_repo(databricks_url, databricks_token, repo_config)
      print(f"Repo id: {repo_id}")
      if not repo_id:
          print("Repo Id is null")
          exit(1)
      else:
          update_repo(databricks_url, databricks_token, repo_id, repo_config)
          print(f"Repository {repo_name} created.")