-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
DOC: dev: stop recommending keeping local master updated with upstream/master #7300
Conversation
…m/master Use the simpler `git fetch; ... upstream/master` approach instead of updating the local master branch. Keeping the local master branch in sync with upstream is usually not necessary.
Finally create a new branch for your work and check it out:: | ||
|
||
git checkout -b my-new-feature master | ||
git checkout -b my-new-feature upstream/master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, does this also update the master branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it does not fetch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The patch links have to point backward to something, so that something can be elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it has to exist locally. However, if you have added remotes via git remote
and do git fetch
(or git pull
), git mirrors locally the branches of the remote repo and the corresponding commits, assigning names <name-of-remote>/<name-of-branch>
to each remote branch. You can get a list of such mirrored remote branches via git branch -r
. As the data is available locally, these work similarly as local branches (don't know what happens if you try to modify them manually --- probably nothing, your changes are just discarded on the next fetch).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at your .git/config
, you have something like this there:
[remote "upstream"]
url = git://github.com/scipy/scipy.git
fetch = +refs/heads/*:refs/remotes/upstream/*
which determines what is fetched, and how the names are mapped.
Note that github stores pull requests in namespace refs/pull/
, so if you're feeling brave, you can add a second fetch mapping:
[remote "upstream"]
url = git://github.com/scipy/scipy.git
fetch = +refs/heads/*:refs/remotes/upstream/*
fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*
so that after git fetch
all pull requests appear as mirrored branches named along the lines of upstream/pr/7300
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting.
DOC: dev: stop recommending keeping local master updated with upstream/master
Thanks Pauli. |
Use the simpler
git fetch; ... upstream/master
approach instead ofupdating the local master branch. Keeping the local master branch
in sync with upstream is usually not necessary.