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

Remote argument for publish and unpublish #113

Merged
merged 1 commit into from
Aug 24, 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
4 changes: 2 additions & 2 deletions doc/examples/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ Publishing:
Git alias:

```git
publish = "!git push -u origin $(git current-branch)"
publish = "!f() { git push -u ${1:-origin} $(git current-branch); }; f"
unpublish = "!git push origin :$(git current-branch)"
unpublish = "!f() { git push ${1:-origin} :$(git current-branch); }; f"
```

Branching:
Expand Down
8 changes: 6 additions & 2 deletions doc/git-publish/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
Git alias:

```git
publish = !"git push --set-upstream origin $(git current-branch)"
publish = "!f() { git push --set-upstream ${1:-origin} $(git current-branch); }; f"
```

Publish the current branch by pushing upstream to origin,
Publish the current branch by pushing to the remote specified by the first argument (defaulting to origin),
and setting the current branch to track the upstream branch.

Example:

```shell
# pushing to origin
git publish

# pushing to fork
git publish fork
```

Compare:
Expand Down
7 changes: 6 additions & 1 deletion doc/git-unpublish/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
Git alias:

```git
unpublish = !"git push origin :$(git current-branch)"
unpublish = "!f() { git push ${1:-origin} :$(git current-branch); }; f"
```

Unpublish the current branch by deleting the
remote version of the current branch.
The remote name may be specified by the first argument and defaults to `origin`.

Example:

```shell
# unpublish on origin
git unpublish

# unpublish branch on fork
git unpublish fork
```

Compare:
Expand Down
4 changes: 2 additions & 2 deletions gitalias.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1372,11 +1372,11 @@

# Publish the current branch by pushing it to the remote "origin",
# and setting the current branch to track the upstream branch.
publish = "!git push --set-upstream origin \"$(git current-branch)\""
publish = "!f() { git push --set-upstream \"${1:-origin}\" \"$(git current-branch)\"; }; f"

# Unpublish the current branch by deleting the
# remote version of the current branch.
unpublish = "!git push origin :\"$(git current-branch)\""
unpublish = "!f() { git push \"${1:-origin}\" :\"$(git current-branch)\"; }; f"

### inbound & outbound ###

Expand Down
Loading