Skip to content

Commit

Permalink
Merge pull request #113 from Samxamnom/publish-unpublish
Browse files Browse the repository at this point in the history
Remote argument for publish and unpublish
  • Loading branch information
joelparkerhenderson authored Aug 24, 2024
2 parents 6ccbd9c + 8e02627 commit ddb75f0
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 ddb75f0

Please sign in to comment.