-
-
Notifications
You must be signed in to change notification settings - Fork 832
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 git worktree command [was: hg share -> git worktree] #105
Comments
Oh, I used git-new-workdir (in git's contrib directory). |
+1 from me. I'd suggest looking up where we used to document hg share and adding a similar example for git worktree. |
+1 for documenting worktree, it's a great feature of git especially when you might be working in multiple branches often (e.g. in our case devel, 3.6, and 3.5). Also, +1 for documenting triangular workflows. Maybe I should open a new issue on this but as I was reading the devguide I noticed that it suggested pushing to origin, i.e. the main repo. In our case since many people won't have permission to do that, I think it's better to recommend forking the main repo and pushing branches for pull requests to your own fork. Generally I still call the main remote 'origin' and my own remote 'warsaw', but the page @tiran references calls the main repo 'upstream' and your own fork 'origin', which probably makes for a better default recommendation. Anybody with git experience will know how to season to taste. |
I have been using I wonder, should core devs really push to the main repos? In all my projects (work and private) I always push to my private clone and then use PR to merge from my private copy to upstream. |
@tiran normally we should propose a PR |
On Feb 11, 2017, at 06:08 AM, Christian Heimes wrote:
I wonder, should core devs really push to the main repos?
No, we should also push to our forks. That way, core devs more closely use
the same workflow non-core devs use, plus it doesn't clutter up the main repo
with additional branches (that often, but not always, get pruned after a
merge).
I personally push to the main repos for some of my projects, but it really
depends on the size of the contributor community. For something as large and
diverse as Python, I think everyone should push to their forks.
|
The only reason someone should end up with a personal branch on python/cpython is if they are fixing a spelling mistake in the browser and they will be deleting their branch in less than 24 hours. Otherwise everything else should go to a personal fork and get merged in through a PR. And it sounds like people like the idea of documenting |
+1 on this. IIRC there was a similar part about hg in devguide before. It's disappointing to not see such a part which does help my workflow. |
I might be able to squeeze in some time next week. If somebody else is going to beat me instead ... go ahead! I wouldn't mind. |
+1 for me too. A good place where to add this would be the tool setup section of the pullrequest page with a link to it in version control setup section of the setup page. FWIW in #103 I also suggested to add more git commands to the pull request page, and this will be a good starting point. |
Another good place to add this would be the remotes setup section of the committing page (even though I don't like that the info are currently scattered around a few different page, and I'm going to propose some refactoring in a separate issue). |
I just set this up myself, and it seems very nice. From my
(I didn't check if you could use "origin/X.Y" directly as the source branches for the worktrees) |
How to create the second worktree for the same branch (for debug build)? What is hg share -U cpython cpython-debug
cd cpython-debug
hg update -C default |
Use |
@ncoghlan @serhiy-storchaka You can also use out-of-tree builds to build different flavors from the same checkout. I use |
@tiran if you're not working on this, can I unassign you and add help-wanted label instead? |
For me, this is the most needed addition to the devguide. |
There are two versions above of how to set shares (worktrees) for 3.6, 3.5, 2.7. Equivalent? I presume that if I want to test a 3.6 backport, I cd into ../3.6 and do the same PR fetch into a new branch as I currently do in cpython. What is not completely clear to me is how to efficiently update multiple repositories, with one fetch from remote. This was easy with hg. One hg-git difference seems to be that hg commands have a '--repository xyz' option to specify the local repository that is the target of the command. Git commands seems to lack this, always using the cwd as target. For multiple workspaces, this would mean multiple cd commands. Correct? |
@Mariatta , see Tiran's Feb 16 message (it said, in effect, 'yes'). |
@terryjreedy There's a |
Thank you. By experimenting, I discovered that 'git help git' opens the local git.html man(1) page that both lists and explains the git options that go before specific subcommands. "-C : Run as if git was started in instead of the current working directory." |
Ah I didn't see that 😅 Thanks @terryjreedy 😃 |
git worktree add ../36 3.6 |
This comment was marked as outdated.
This comment was marked as outdated.
I'm going to close this issue since the move to git workflow is pretty dated at this point in time. For folks interested in the discussion, the closed issue still keeps that available through search. |
I believe we should keep this open; adding info about |
Also, please use "Close as not planned" when closing issues as wont-fix, duplicate, outdated, invalid, etc. |
@erlend-aasland If we want to keep this open, let's scope the issue down to "Add info about I didn't know we had a "Close at not planned" label. Thanks for the tip. |
Quoting the OP:
AFAICS, that is the scope of this issue. |
(Close as not planned is not a project label, but a recent github feature accessible in a dropdown in the close button) |
Please see PR #1255. |
I used hg share a lot to share a single hg clone between multiple working directories. It's convenient to have a lean copy for each branch of Python (2.7, 3.5, 3.6). git has a similar feature called worktree, https://git-scm.com/docs/git-worktree . It took me a bit to find it. Other developers may find the feature useful, too. What do you think about documenting git worktree in the dev guide?
The text was updated successfully, but these errors were encountered: