curl --request POST \
--url https://app.base44.com/api/apps/{app_id}/imported/git/discard \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.base44.com/api/apps/{app_id}/imported/git/discard"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.base44.com/api/apps/{app_id}/imported/git/discard', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.base44.com/api/apps/{app_id}/imported/git/discard",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.base44.com/api/apps/{app_id}/imported/git/discard"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.base44.com/api/apps/{app_id}/imported/git/discard")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/apps/{app_id}/imported/git/discard")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"current_branch": "feature/checkout",
"default_branch": "main",
"base_branch": "main",
"head": "9fceb02d0ae598e95dc970b74767f19372d61af8",
"head_committed_at": "2026-10-28T09:15:00Z",
"dirty": false,
"dirty_files": [],
"ahead": 1,
"behind": 0,
"merge_in_progress": false
}Discard branch changes
Throws away a branch’s uncommitted changes, so it matches its latest commit again. Committed changes and anything already on GitHub stay. This works on apps imported from GitHub.
Send the branch as branch_id, or leave it out for the main branch. The call runs in that branch’s environment. If the environment isn’t running, the call starts it first, which can take a few minutes. Discarded changes can’t be recovered. Discarding when there’s nothing to discard returns the current state.
This endpoint is limited to 10 requests per minute per user, shared with Commit branch changes, Revert branch file changes, Open pull request and Update pull request, and reported in the X-RateLimit-* headers.
api_key query parameter is refused.curl --request POST \
--url https://app.base44.com/api/apps/{app_id}/imported/git/discard \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.base44.com/api/apps/{app_id}/imported/git/discard"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.base44.com/api/apps/{app_id}/imported/git/discard', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.base44.com/api/apps/{app_id}/imported/git/discard",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.base44.com/api/apps/{app_id}/imported/git/discard"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.base44.com/api/apps/{app_id}/imported/git/discard")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/apps/{app_id}/imported/git/discard")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"current_branch": "feature/checkout",
"default_branch": "main",
"base_branch": "main",
"head": "9fceb02d0ae598e95dc970b74767f19372d61af8",
"head_committed_at": "2026-10-28T09:15:00Z",
"dirty": false,
"dirty_files": [],
"ahead": 1,
"behind": 0,
"merge_in_progress": false
}Authorizations
Personal access token, sent as Authorization: Bearer <token>. Each operation lists the permission it needs: read_only or full_access. A full-access token can call every operation. A read-only token can call only the operations that list read_only; anything else returns 403 read_only_credential_route_not_allowed.
Path Parameters
ID of the app.
Query Parameters
ID of the branch to work on, as returned by List branches. Omit it to work on the app's main branch.
Response
The branch's git state after discarding.
Branch checked out in the branch's environment, or HEAD when none is checked out.
"feature/checkout"
The repository's default branch on GitHub.
"main"
The branch the app was imported from. Pull requests merge into it.
"main"
SHA of the latest commit, or null when the branch has no commits.
"9fceb02d0ae598e95dc970b74767f19372d61af8"
When the latest commit was made, as an ISO 8601 UTC timestamp, or null.
"2026-10-28T09:15:00Z"
Whether there are uncommitted changes.
true
Paths of the first 20 files with uncommitted changes. A renamed file reads old -> new.
["src/pages/Checkout.jsx"]
Commits not pushed to GitHub yet, or null when the branch isn't on GitHub.
1
Commits on GitHub the environment doesn't have yet, as of its last fetch, or null when the branch isn't on GitHub.
0
Whether a merge is under way, for example while conflicts are resolved.
false
Was this page helpful?