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

Support publishing to a branch #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Treora
Copy link

@Treora Treora commented Apr 23, 2020

Fixes #5.

This allows passing --branch <branchname> to append the newly created commit to an existing branch.

To make this happen, I changed the code to use git workdir, to check out the branch in a second (temporary) directory without creating a new repo.

While at it I also made that push won’t break if the used tag has the same name as a branch, by explicitly pushing refs/tags/${tag} instead of just tag.

I hope I covered the failure cases; e.g. removing the worktree and tag and resetting the branch if publishing fails. It may be worth checking such scenarios.

Some error and success messages that are presented may deserve an update, I did not address this yet as possibly issue #6 (multiple tags), if incorporated too, may require changing those again. Likewise I did not yet provide a possibility to publish only to a branch without creating a tag.

Also switch to using `git workdir` instead of creating a remote repo.
This was referenced Apr 23, 2020
@Rush
Copy link
Owner

Rush commented Apr 23, 2020

Wow, nice job! I think I need some time to process the changes, especially since you changed all the code paths. :) Didn't know about git worktree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publish (also) as a branch
2 participants