Skip to content

Commit 483b9cd

Browse files
authored
Merge pull request #10076 from dolthub/tim/checkout-in-agent-md
Add a dolt checkout section to AGENT.md
2 parents eb93948 + eee8cc3 commit 483b9cd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

go/libraries/doltcore/doltdb/AGENT.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ dolt checkout <branch-name>
4545
dolt checkout -b <branch-name>
4646
```
4747

48+
### Checkout Behavior with Running SQL Servers
49+
- `dolt checkout` on the CLI only affects the shell process that runs the command. When a `dolt sql-server` is running, existing SQL connections keep their current branch until they explicitly switch.
50+
- Each SQL session (CLI `dolt sql`, MySQL client, application connection) maintains its own active branch. Run `CALL dolt_checkout('<branch>');` at the beginning of every session or scripted block to ensure you are on the correct branch.
51+
- Chain branch changes inside scripts: start with `CALL dolt_checkout('<branch>');`, then run your queries. Do not assume a previous checkout persists for new connections.
52+
- When automating, include the checkout in the same transaction / session context where the data changes execute.
53+
- A good way to make sure a `dolt sql` session connects to the br1 branch for instance is `dolt --branch br1 sql`.
54+
4855
### Data Operations
4956
```bash
5057
# Stage changes

0 commit comments

Comments
 (0)