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

fix(submit): Prefer remote.pushDefault #546

Closed

Conversation

claytonrcarter
Copy link
Collaborator

Hi there. I'm just opening this for discussion's sake. I tried out the sweet new git submit command for #545 and found that either I'm misunderstanding how to use it, or it might not be set up correctly to handle the "triangle" or forked remote workflow, as it pushed my branch directly to origin (this repo) instead of my fork as I had intended.

In my case, master branch is tracking origin/master, but I've got remote.pushDefault set to claytonrcarter, which is my fork. As I understand the current code, git submit will prefer whatever remote is being tracked by the main branch, in my case origin, and will only use pushDefault if there is no main tracking branch. Unless I'm misreading this, this seems like it might make pushDefault useful only before a remote is added ... maybe?

Anyway, I'm suggesting that we prefer pushDefault over whatever the main branch is using. I tried this out to push this change, and it worked as expected.

If this is not correct, please feel free to close and, if you don't mind, give me a little hint about how/why I'm misusing and/or misunderstanding this. Thanks!

@arxanas
Copy link
Owner

arxanas commented Sep 18, 2022

The intention was to only use remote.pushDefault for branches which don't track any branch yet, and set branch.<name>.pushRemote for branches which need to pull and push from different places. So for your main branch, you should set the push-remote to create the "triangle". See https://git-scm.com/docs/git-config#Documentation/git-config.txt-branchltnamegtpushRemote. But I don't remember if I actually implemented pushRemote in git submit or not, so that might remain to be done.

@claytonrcarter
Copy link
Collaborator Author

The intention was to only use remote.pushDefault for branches which don't track any branch yet, and set branch..pushRemote for branches which need to pull and push from different places

Thank you, that is what I was missing ... and in fact I failed to read all the way through. It looks like branch.{branch_name}.pushRemote is implemented already, and I was just ignorant of it.

Thank you and sorry for the distraction!

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.

2 participants