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

How do you push a Git tag to a branch using a refspec? #423

Open
twgcode opened this issue Nov 30, 2021 · 2 comments
Open

How do you push a Git tag to a branch using a refspec? #423

twgcode opened this issue Nov 30, 2021 · 2 comments
Labels
stale Issues/PRs that are marked for closure due to inactivity

Comments

@twgcode
Copy link

twgcode commented Nov 30, 2021

How to implement the following commands:
git push origin tagName1^{}:master

tagName1 is the name of a tag

@tjamet
Copy link
Contributor

tjamet commented Dec 15, 2021

Hi!
If I may, I had a similar case that I happen to have open-sourced recently.
In my case, I am pushing a given sha, but the logic would probably be similar if the syntax is supported in the current implementation.

The implementation is here: https://github.com/adevinta/maiao/blob/9e7f216e631f5d1ca171d472792510cc18bd34fe/pkg/maiao/review.go#L218

More specifically, I used:

	refToPush := "tagName1^{}"
	refspecs := []config.RefSpec{config.RefSpec(refToPush+":refs/heads/master")}

	err = repo.Push(&git.PushOptions{
		RemoteName: "origin",
		RefSpecs:   refspecs,
	})

To support pushing with a given sha, I had to add support for it: #325

Hope this helps

Copy link

To help us keep things tidy and focus on the active tasks, we've introduced a stale bot to spot issues/PRs that haven't had any activity in a while.

This particular issue hasn't had any updates or activity in the past 90 days, so it's been labeled as 'stale'. If it remains inactive for the next 30 days, it'll be automatically closed.

We understand everyone's busy, but if this issue is still important to you, please feel free to add a comment or make an update to keep it active.

Thanks for your understanding and cooperation!

@github-actions github-actions bot added the stale Issues/PRs that are marked for closure due to inactivity label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issues/PRs that are marked for closure due to inactivity
Projects
None yet
Development

No branches or pull requests

2 participants