Skip to content
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

Document possible workflows for subrepo PRs #4

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,76 @@ them and then do:

% git subrepo push ext/os-autoinst-common

### Possible Workflows

One can make changes to the subrepo directly from the top repo, but there are
different strategies.

#### Make changes in top repo first and push after approval

* Create a branch in the top repo
* Make changes in the subrepo directory
* Create PR
* After approval, merge and push changes to subrepo


Prepare:

% git checkout -b feature1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer no % in code blocks for easier copying into terminals :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old-school % prompt is so far being used everywhere. I'd suggest to change this separately.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

% is the default zsh prompt.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regardless which shell you use and what prompt character it uses, if it is $ for a user-bash, # for a root-bash, % in zsh or > in tcsh, please use shell code sections without prefixes for easier copying. Compare to https://github.com/os-autoinst/scripts/blob/master/README.md#openqa-label-known-issues

# Pull subrepo changes first to avoid merges later
% git subrepo pull external/os-autoinst-common
# This will create a commit automatically if there are any changes
# If there are functional changes, it might be good to do this in an extra
# PR first

Make changes:

% touch external/os-autoinst-common/foo
% git add .
% git commit
% git push -u fork feature1
# Create PR

When the PR is merged, push the changes directly to the subrepo master if you
have the allowance.

Check if there were any changes in the subrepo in the meantime with

% git subrepo pull external/os-autoinst-common

Push:

% git subrepo push external/os-autoinst-common

#### Make changes in a subrepo fork/branch

This will allow to test the PR in several top repos.

First create a branch in your `os-autoinst-common` fork (or in `origin`, if ok).

% cd /path/to/os-autoinst-common
% git pull
% git checkout -b feature1
% git push -u fork feature1

Make changes in the top repo, e.g. `openQA`:

% cd /path/to/openQA
% git checkout -b feature1
% git subrepo clone -f git@url-to-your-fork -b feature1
% touch external/os-autoinst-common/foo
% git add .
% git commit
% git subrepo push external/os-autoinst-common
% git push -u fork feature1
# Create WIP openQA PR to test the changes
# Create os-autoinst-common PR

When the `os-autoinst-common` PR is merged, just reset your `openQA` `feature1`
branch to master and do

% git subrepo pull external/os-autoinst-common

## git-subrepo

You can find more information here:
Expand Down