File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # [start-readme]
4+ #
5+ # This script is run on a writer's machine to create an Early Access branch that matches the current docs-internal branch.
6+ #
7+ # [end-readme]
8+
9+ set -e
10+
11+ # Get current branch name
12+ currentBranch=$( git rev-parse --abbrev-ref HEAD)
13+
14+ if [ $currentBranch == " main" ]; then
15+ echo " You cannot run this script on the 'main' branch. Checkout a new branch first."
16+ exit 0
17+ fi
18+
19+ # Go up a directory
20+ pushd .. > /dev/null
21+
22+ if [ ! -d " docs-early-access" ]; then
23+ echo " A 'docs-early-access' directory does not exist! Run script/early-access/clone-locally first."
24+ popd > /dev/null
25+ exit 0
26+ fi
27+
28+ # Navigate to docs-early-access
29+ cd docs-early-access
30+
31+ # Check out main and update
32+ git checkout main
33+ git pull origin main
34+
35+ # Creat a branch with the current docs-internal branch name
36+ git checkout -b $currentBranch
37+
38+ # Go back to the previous working directory
39+ popd > /dev/null
40+
41+ echo -e " \nDone! Created a branch called ${currentBranch} . Remember to commit your work in ../docs-early-access when you're ready."
You can’t perform that action at this time.
0 commit comments