-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: merge forward script fails when branch is already checked out #10946
Conversation
The [AutoPullRequest] CodeBuild job already checks out the base branch. This causes the `git checkout -b` command to fail since the branch already exists. Update the script so that branch creation occurs only if it does not already exist. [AutoPullRequest]: https://github.com/aws/cdk-ops/blob/21acd7ff37ad9ab14d8c3f9b41980e9f62f64503/lib/cdk-pipeline.ts#L284-L290
scripts/merge-forward.sh
Outdated
|
||
# create 'v2-main' if it does not already exist | ||
(git branch --list | grep 'v2-main') || git checkout -b v2-main origin/v2-main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm reading the man page right, this is exactly what '-B' is made to do. https://git-scm.com/docs/git-checkout
(git branch --list | grep 'v2-main') || git checkout -b v2-main origin/v2-main | |
git checkout -B v2-main origin/v2-main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I seem to have missed that in the man page.
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
The AutoPullRequest CodeBuild job already checks out the base branch.
This causes the
git checkout -b
command to fail since the branchalready exists.
Update the script so that branch creation occurs only if it does not
already exist.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license