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

Update Exploring History episode to reflect commands replacing checkout (restore, switch etc.) #776

Closed
torwhite opened this issue Jan 22, 2021 · 2 comments

Comments

@torwhite
Copy link

torwhite commented Jan 22, 2021

This episode should probably be generally re-worked to reflect the new commands to replace checkout including restore and switch, but below are specific points where the new version of git's outputs differ from the lesson text.

  1. the output text for git status (unstaged edits) is out of date:
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
...

updated output:

On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
...
  1. the output text for git status (staged edits) is out of date:
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   mars.txt

updated output:

On branch main

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   mars.txt
  1. the text for the detached head is out of date:
Note: checking out 'f22b25e'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

 git checkout -b <new-branch-name>
...

updated output:

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false
...
@kekoziar
Copy link
Contributor

kekoziar commented Jul 5, 2021

Thanks for catching these, @torwhite. Feel free to submit PRs that update the output.

@kekoziar
Copy link
Contributor

duplicate of #691.
I think we're holding off on this because restore and switch are labeled as experimental, while checkout still works.

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

No branches or pull requests

2 participants