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

Add upstream config to Contributing.MD #1554

Closed
lamar-frankie opened this issue Oct 18, 2017 · 12 comments
Closed

Add upstream config to Contributing.MD #1554

lamar-frankie opened this issue Oct 18, 2017 · 12 comments
Labels
documentation Issues/PRs modifying the documentation.

Comments

@lamar-frankie
Copy link
Contributor

The command line section is missing a step. After the contributor creates a feature branch locally they need to set the remote upstream or else attempts to push will fail.

Example:

git push --set-upstream origin {{feature_branch_name}}

@agnivade
Copy link
Member

Hi @lamar-frankie,

I am a bit confused. --set-upstream or -u is used to set the remote branch name when pushing. This is used in case when your local branch is different from the remote branch where you want to push. But you are saying unless the -u is set, attempts to push will fail. I have personally never seen this.

Also, you are interchangeably using the words remote upstream with remote branch. Your command invocation should actually be git push origin -u remote_branch.

Are you sure your local and remote branches have the same name and the remote is set properly ?

@mfrw
Copy link
Member

mfrw commented Oct 20, 2017

@agnivade In my opinion what @lamar-frankie wants to say is
git push origin {{feature_branch_name}}
The walk through given in the CONTRIBUTING.md first instructs to fork the main repo, then create a local branch for modification and fiinally push to the fork.
Then create a pull request from it.

The guide just uses git push instead of git push origin {{feature_branch}} which fails if you dont already have a {{feature_branch}} in the local fork.

@lamar-frankie
Copy link
Contributor Author

Following the steps on the Contributing page gives you a local branch that isn't connected to a remote.

@agnivade
Copy link
Member

I see the issue. This is a change in git behavior.

20:37:08-agniva-~/Downloads/tldr$git push 
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

Earlier, by default, git push meant git push origin <current_branch>. But now, that does not seem to be the case. Thanks for bringing to notice.

This does not need the --set-upstream flag however. A simple git push origin <branch> is sufficient. Hence, my confusion earlier.

I will update the page.

@agnivade agnivade added the documentation Issues/PRs modifying the documentation. label Oct 20, 2017
mfrw added a commit to mfrw/tldr that referenced this issue Oct 20, 2017
git push from a local branch fails if there is no branch of the
same name in the remote repository.
@mfrw
Copy link
Member

mfrw commented Oct 20, 2017

@agnivade ohh are you going to update the page yourself,
actually, I had almost made a pr.
Should I continue with the pr or you would do the changes yourself?

cheers

@agnivade
Copy link
Member

Sure, please send a PR.

@sbrl
Copy link
Member

sbrl commented Oct 21, 2017

Running it with --set-upstream means that you don't have to use the full git push {{origin}} {{master}}, and instead you can use simply git push.

@agnivade
Copy link
Member

Yea it's a one-off thing. I prefer the full command since the page is going to be read by a lot of people using git for the first time.

@sbrl
Copy link
Member

sbrl commented Oct 21, 2017

With #1560, does that mean that this issue can be closed?

@mfrw
Copy link
Member

mfrw commented Oct 21, 2017

@sbrl I think we should close it

@sbrl
Copy link
Member

sbrl commented Oct 21, 2017

@mfrw Yeah, you're probably right. Closing now.

@sbrl sbrl closed this as completed Oct 21, 2017
@agnivade
Copy link
Member

Ah, I forgot to add the "Closes" magic word in the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issues/PRs modifying the documentation.
Projects
None yet
Development

No branches or pull requests

4 participants