Correct suggested git commands for checkout 5.x#10713
Merged
Merged
Conversation
Contributor
Author
|
#9900 is relevant as that's where this language comes from |
Member
|
Thanks! +1 to the shorter, more modern spelling if you want to update this PR. |
The current instructions suggest `git checkout -b origin/5.x`, but this creates a new branch off of the current commit with the confusing name "origin/5.x" instead of creating a local branch with the default upstream of origin/5.x. Some better options include: 1. `git checkout origin/5.x` - prints unnerving error message about detached head, but successfully checkout out 5.x 2. `git checkout -b 5.x origin/5.x` - create a new branch off of origin/5.x, tracking origin/5.x - unfortunately confusing to type 3. `git checkout 5.x` - for git 1.7.2.3 (2010) and higher (according to [second hand source](https://stackoverflow.com/questions/9537392/git-fetch-remote-branch)) does the same as command 2. 4. `git checkout --track origin/5.x` does the same as command 2 for even older versions of git. This commit uses `git checkout 5.x` since seven years is a long time.
Contributor
Author
|
Updated to use shorter, more modern spelling. |
Member
|
:-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current instructions suggest
git checkout -b origin/5.x, but this creates a new branch off of the current commit with the confusing name "origin/5.x" instead of creating a local branch with the default upstream of origin/5.x.Some better options include:
git checkout origin/5.x- prints unnerving error message about detached head, but successfully checkout out 5.xgit checkout -b 5.x origin/5.x- create a new branch off of origin/5.x, tracking origin/5.x - unfortunately confusing to typegit checkout 5.x- for git 1.7.2.3 (2010) and higher (according to second hand source) does the same as command 2.git checkout --track origin/daves_branchdoes the same for even older versions of git.I propose
git checkout -b 5.x origin/5.xso as to make no assumptions about git version and to avoid the "detached head" warning that can be unnerving, and to prepare users to later pull to a tracking branch for updates. But we can rely on git version installed being less than 7 years old,git checkout 5.xwould be better.