Skip to content

Rename upstreams dependencies #1

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

Merged
merged 8 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
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
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Git shortcuts for implementing the scalable git branching model

The Scalable Git Branching Model has recently been updated; see the new
terminology in [A scalable Git branching model,
Revisited](https://dekrey.net/articles/scalable-git-branching-model-revisited/).

## Prerequisites

- Powershell Core (7+)
Expand All @@ -25,34 +29,34 @@ Note: if you have an older version installed, such as .NET 7, you can [install a

Relative paths work, too. To clone and run, you may use the following commands:

git clone https://github.com/PrincipleStudios/scalable-git-branching-tools.git ../scalable-git-branching-tools
git clone https://github.com/DarkPatternsDigital/scalable-git-branching-tools.git ../scalable-git-branching-tools
../scalable-git-branching-tools/init.ps1

## Commands

[`git tool-update`](./docs/tool-update.md)
[`git tool-update`](./docs/tool-update.md) - Attempts to update these tools

[`git tool-config`](./docs/tool-config.md)
[`git tool-config`](./docs/tool-config.md) - Configures these tools

[`git new`](./docs/new.md)
[`git new`](./docs/new.md) - Create a new branch with tracked dependencies

[`git pull-upstream`](./docs/pull-upstream.md)
[`git pull-deps`](./docs/pull-deps.md) - Pull dependencies into your current branch

[`git show-downstream`](./docs/show-downstream.md)
[`git show-dependants`](./docs/show-dependants.md) - Shows dependants of the current branch

[`git show-upstream`](./docs/show-upstream.md)
[`git show-deps`](./docs/show-deps.md) - Shows dependencies of the current branch

[`git add-upstream`](./docs/add-upstream.md)
[`git add-deps`](./docs/add-deps.md) - Adds one or more dependencies to the current branch

[`git rc`](./docs/rc.md)
[`git rc`](./docs/rc.md) - Creates a release candidate out of one or more dependencies

[`git rebuild-rc`](./docs/rebuild-rc.md)
[`git rebuild-rc`](./docs/rebuild-rc.md) - Recreates a release candidate, modifying its dependencies.

[`git verify-updated`](./docs/verify-updated.md)
[`git verify-updated`](./docs/verify-updated.md) - Verifies if the current branch is up-to-date wit its dependencies

[`git refactor-upstream`](./docs/refactor-upstream.md)
[`git refactor-deps`](./docs/refactor-deps.md) - Rewrites the dependencies tree as directed

[`git release`](./docs/release.md)
[`git release`](./docs/release.md) - Releases and cleans up branches

## Development

Expand Down
2 changes: 1 addition & 1 deletion adr/01-principles.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ Tools should be written with the following in mind:

[scalable-git]: https://dekrey.net/articles/scaled-git-flow/
[principle-scalable-git]: https://www.principlestudios.com/article/a-scalable-git-branching-model/
[principle-tools-branching]: https://principle.tools/branching/
[principle-tools-branching]: https://principle.tools/branching/
2 changes: 1 addition & 1 deletion adr/02-code-organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ Under this methodology, the `git new` command would have the basic outline:
5. Finalize actions
- `Invoke-FinalizeAction`
- A single `git push` would set `_upstream` and create the new branch
- Checkout the new branch
- Checkout the new branch
10 changes: 5 additions & 5 deletions demos/_setup-existing.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ try {

/git-tools/init.ps1

git add-upstream main -target feature/add-item-1
git add-upstream main -target feature/add-item-2
git add-upstream main -target feature/change-existing-item-A
git add-upstream main -target feature/change-existing-item-B
git add-upstream feature/add-item-1 -target feature/subfeature
git add-deps main -target feature/add-item-1
git add-deps main -target feature/add-item-2
git add-deps main -target feature/change-existing-item-A
git add-deps main -target feature/change-existing-item-B
git add-deps feature/add-item-1 -target feature/subfeature

} finally {
Pop-Location
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-local-cd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if ((git branch --show-current) -ne 'feature/PS-1') {
throw 'Branch name did not match expected';
}

git rc rc/test -u feature/add-item-1,feature/add-item-2
git rc rc/test -d feature/add-item-1,feature/add-item-2
ThrowOnNativeFalure

if ((git branch --show-current) -ne 'feature/PS-1') {
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-local-with-space.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if ((git branch --show-current) -ne 'feature/PS-1') {
throw 'Branch name did not match expected';
}

git rc rc/test -u feature/add-item-1,feature/add-item-2
git rc rc/test -d feature/add-item-1,feature/add-item-2
ThrowOnNativeFalure

if ((git branch --show-current) -ne 'feature/PS-1') {
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-local.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if ((git branch --show-current) -ne 'feature/PS-1') {
throw 'Branch name did not match expected';
}

git rc rc/test -u feature/add-item-1,feature/add-item-2
git rc rc/test -d feature/add-item-1,feature/add-item-2
ThrowOnNativeFalure

if ((git branch --show-current) -ne 'feature/PS-1') {
Expand Down
4 changes: 2 additions & 2 deletions demos/demo-remote-release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ git clone ./origin local
cd local
/git-tools/init.ps1

git new feature/PS-1 -u feature/add-item-1
git new feature/PS-1 -d feature/add-item-1
ThrowOnNativeFalure

git rc rc/test -u feature/subfeature,feature/add-item-2
git rc rc/test -d feature/subfeature,feature/add-item-2
ThrowOnNativeFalure

git verify-updated rc/test
Expand Down
8 changes: 4 additions & 4 deletions demos/demo-remote-without-config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ if ((git branch --show-current) -ne 'feature/PS-1') {
throw 'Branch name did not match expected';
}

$upstreamOfNewFeature = [string[]](git show-upstream)
if ($upstreamOfNewFeature -notcontains 'main') {
throw "Expected main to be upstream of the current branch; found: $(ConvertTo-Json $upstreamOfNewFeature)"
$dependencyOfNewFeature = [string[]](git show-deps)
if ($dependencyOfNewFeature -notcontains 'main') {
throw "Expected main to be dependency of the current branch; found: $(ConvertTo-Json $dependencyOfNewFeature)"
}

git rc rc/test -u feature/add-item-1,feature/add-item-2
git rc rc/test -d feature/add-item-1,feature/add-item-2
ThrowOnNativeFalure

if ((git branch --show-current) -ne 'feature/PS-1') {
Expand Down
12 changes: 6 additions & 6 deletions demos/demo-remote.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ git clone ./origin local
cd local
/git-tools/init.ps1

git new feature/PS-1 -u feature/add-item-1
git new feature/PS-1 -d feature/add-item-1
ThrowOnNativeFalure

if ((git rev-parse origin/feature/add-item-1) -ne (git rev-parse HEAD)) {
Expand All @@ -24,19 +24,19 @@ if ((git branch --show-current) -ne 'feature/PS-1') {
throw 'Branch name did not match expected';
}

$upstreamOfNewFeature = [string[]](git show-upstream -recurse)
if ($upstreamOfNewFeature -notcontains 'main') {
throw "Expected main to be upstream of the current branch; found: $(ConvertTo-Json $upstreamOfNewFeature)"
$dependencyOfNewFeature = [string[]](git show-deps -recurse)
if ($dependencyOfNewFeature -notcontains 'main') {
throw "Expected main to be dependency of the current branch; found: $(ConvertTo-Json $dependencyOfNewFeature)"
}

git rc rc/test -u feature/add-item-1,feature/add-item-2
git rc rc/test -d feature/add-item-1,feature/add-item-2
ThrowOnNativeFalure

if ((git branch --show-current) -ne 'feature/PS-1') {
throw 'Branch name should not have changed';
}

git pull-upstream rc/test
git pull-deps rc/test
ThrowOnNativeFalure

git verify-updated rc/test
Expand Down
14 changes: 7 additions & 7 deletions docs/add-upstream.md → docs/add-deps.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# `git add-upstream`
# `git add-deps`

Adds one or more upstream branches to an existing branch.
Adds one or more dependency branches to an existing branch.

Usage:

git-add-upstream.ps1 [-upstreamBranches] <string[]> [-target <string>] [-comment <string>] [-dryRun]
git-add-deps.ps1 [-dependencyBranches] <string[]> [-target <string>] [-comment <string>] [-dryRun]

## Parameters

### `[-upstreamBranches] <string[]>`
### `[-dependencyBranches] <string[]>`

_Aliases: -u, -upstream, -upstreams_
_Aliases: -d, -dependency, -dependencies_

A comma-delimited list of branches to add upstream of the existing branch.
A comma-delimited list of branches to add dependency of the existing branch.

### `-target <string>` (Optional)

Expand All @@ -22,7 +22,7 @@ The existing branch to update. If not specified, use the current branch.

_Aliases: -m, -message_

If specified, include this comment in the commit message for the upstream
If specified, include this comment in the commit message for the dependency
tracking branch when pushing changes.

### `-dryRun` (Optional)
Expand Down
8 changes: 4 additions & 4 deletions docs/new.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Creates a new branch and checks it out from the specified branches
Usage:

git-new.ps1 [-branchName] <string> [-comment <string>] `
[-upstreamBranches <string[]>] [-dryRun]
[-dependencyBranches <string[]>] [-dryRun]

## Parameters:

Expand All @@ -17,11 +17,11 @@ Specifies the name of the branch.

_Aliases: -m, -message_

Specifies a comment as part of the commit message for the upstream branch.
Specifies a comment as part of the commit message for the dependency branch.

### `-upstreamBranches <string>` (Optional)
### `-dependencyBranches <string>` (Optional)

_Aliases: -u, -upstream, -upstreams_
_Aliases: -d, -dependency, -dependencies_

A comma-delimited list of branches (without the remote, if applicable). If not
specified, assumes the default service line (see [tool-config][tool-config].)
Expand Down
10 changes: 5 additions & 5 deletions docs/pull-upstream.md → docs/pull-deps.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# `git pull-upstream`
# `git pull-deps`

Merges all the "upstream" branches into the current branch, or the specified one
Merges all the "dependency" branches into the current branch, or the specified one
if provided. Note that this doesn't ensure those branches are up-to-date, only
merges them into the current branch. If working with a remote, pushes the merge
to the remote.

Usage:

git-pull-upstream.ps1 [-target <string>] [-recurse] [-dryRun]
git-pull-deps.ps1 [-target <string>] [-recurse] [-dryRun]

## Parameters

### `[-target] <string>` (Optional)

If provided, the script will change branches to the named branch, and
pull-upstream for that branch. If it succeeds, `pull-upstream` will return to
pull-deps for that branch. If it succeeds, `pull-deps` will return to
the original branch. Otherwise, conflicts will be left uncommitted.

### `-recurse` (Optional)

If specified, will first attempt to merge branches further upstream. If any
If specified, will first attempt to merge branches further dependency. If any
merges fail, the propagation will be halted to prevent irrelevant conflicts from
being reported.

Expand Down
16 changes: 8 additions & 8 deletions docs/rc.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# `git rc`

Create a new branch from multiple upstream branches without changing the local
Create a new branch from multiple dependency branches without changing the local
branch. Intended for creating release candidate branches.

Usage:

git-rc.ps1 [-target] <string> [-upstreamBranches <string[]>] [-comment <string>] [-force] [-dryRun] [-allowOutOfDate] [-allowNoUpstreams]
git-rc.ps1 [-target] <string> [-dependencyBranches <string[]>] [-comment <string>] [-force] [-dryRun] [-allowOutOfDate] [-allowNoDependencies]

## Parameters

### `[-target] <string>`

The name of the new branch.

### `-upstreamBranches <string[]>`
### `-dependencyBranches <string[]>`

_Aliases: -u, -upstream, -upstreams_
_Aliases: -d, -dependency, -dependencies_

Comma-delimited list of branches to merge into the new branch.

### `-comment <string>` (Optional)

_Aliases: -m, -message_

If specified, adds to the commit message on the upstream tracking branch for
If specified, adds to the commit message on the dependency tracking branch for
creating the RC branch.

### `-force` (Optional)
Expand All @@ -33,12 +33,12 @@ branch.

### `-allowOutOfDate` (Optional)

Allows branches that are not up-to-date with their upstreams. (This is the old
Allows branches that are not up-to-date with their dependencies. (This is the old
behavior.)

### `-allowNoUpstreams` (Optional)
### `-allowNoDependencies` (Optional)

Allows branches that do not have any upstreams. (This is the old behavior.)
Allows branches that do not have any dependencies. (This is the old behavior.)

### `-dryRun` (Optional)

Expand Down
20 changes: 10 additions & 10 deletions docs/rebuild-rc.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# `git rebuild-rc`

Recreate a branch from its upstream branches, possibly modifying the upstream
Recreate a branch from its dependency branches, possibly modifying the dependency
branches. Intended for creating release candidate branches.

Usage:

git-rc.ps1 [-target] <string> [-with <string[]>] [-without <string[]>] [-comment <string>] [-dryRun] [-allowOutOfDate] [-allowNoUpstreams]
git-rc.ps1 [-target] <string> [-with <string[]>] [-without <string[]>] [-comment <string>] [-dryRun] [-allowOutOfDate] [-allowNoDependencies]

## Parameters

Expand All @@ -15,30 +15,30 @@ The name of the new branch.

### `-with <string[]>`

_Aliases: -add, -addUpstream, -upstreamBranches_
_Aliases: -add, -addDependency, -dependencyBranches_

Comma-delimited list of branches to add upstream of the rc when rebuilding
Comma-delimited list of branches to add dependency of the rc when rebuilding

### `-without <string[]>`

_Aliases: -remoce, -removeUpstream_
_Aliases: -remoce, -removeDependency_

Comma-delimited list of branches to remove upstream of the rc when rebuilding
Comma-delimited list of branches to remove dependency of the rc when rebuilding

### `-comment <string>` (Optional)

_Aliases: -m, -message_

If specified, adds to the commit message on the upstream tracking branch for
If specified, adds to the commit message on the dependency tracking branch for
creating the RC branch.

### `-allowOutOfDate` (Optional)

Allows branches that are not up-to-date with their upstreams.
Allows branches that are not up-to-date with their dependencies.

### `-allowNoUpstreams` (Optional)
### `-allowNoDependencies` (Optional)

Allows branches that do not have any upstreams.
Allows branches that do not have any dependencies.

### `-dryRun` (Optional)

Expand Down
Loading