forked from MicrosoftDocs/mslearn-tailspin-spacegame-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add feature branch update instructions
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,40 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope | |
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
|
||
## For maintainers: Updating feature branches | ||
|
||
This repository uses feature branches to associate code with specific modules on Microsoft Learn. Any changes you make to the default branch will likely need to be propagated to each feature branch in this repo. A common example is when we need to update Node packages in `package.json`. | ||
|
||
Here's one way to update the remote feature branches when you make a change to the default branch. Note that this process deletes all local branches except for `main`. | ||
|
||
```bash | ||
# Synchronize with the remote main branch | ||
git checkout main | ||
git pull origin main | ||
# Delete all local branches except for main | ||
git branch | grep -ve "main" | xargs git branch -D | ||
# List all remote branches except for main | ||
branches=$(git branch -r 2> /dev/null | grep -ve "main" | cut -d "/" -f 2) | ||
# Synchronize each branch with main and push the result | ||
while IFS= read -r branch; do | ||
# Fetch and switch to feature branch | ||
git fetch origin $branch | ||
git checkout $branch | ||
# Ensure local environment is free of extra files | ||
git clean -xdf | ||
# Merge down main | ||
git merge --no-ff main | ||
# Break out if merge failed | ||
if [ $? -ne 0 ]; then | ||
break | ||
fi | ||
# Push update | ||
git push origin $branch | ||
done <<< "$branches" | ||
# Switch back to main | ||
git checkout main | ||
``` | ||
|
||
# Legal Notices | ||
|
||
Microsoft and any contributors grant you a license to the Microsoft documentation and other content | ||
|