Skip to content

Commit

Permalink
Remote argument for publish and unpublish
Browse files Browse the repository at this point in the history
  • Loading branch information
Samxamnom committed Aug 24, 2024
1 parent 6ccbd9c commit 8e02627
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
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

0 comments on commit 8e02627

Please sign in to comment.