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

Recovering Older Versions of a File mistake in excercise #1025

Open
novica opened this issue Oct 22, 2024 · 3 comments
Open

Recovering Older Versions of a File mistake in excercise #1025

novica opened this issue Oct 22, 2024 · 3 comments

Comments

@novica
Copy link
Contributor

novica commented Oct 22, 2024

What is the problem?

Recovering Older Versions of a File exerciese in the lesson has an answer that does not correspond to the question. Correct solution says it is both 2 and 4 that are correct but explanation says that 2 is not what we want. My guess is this is just a number mismatch and the correct answer should either say 3 and 4 are correct or reorder the items in the question.

Location of problem (optional)

https://swcarpentry.github.io/git-novice/instructor/05-history.html

@novica novica changed the title Recovering Older Versions of a File Recovering Older Versions of a File mistake in excercise Oct 22, 2024
@martinosorb
Copy link
Contributor

Hi, thanks for catching this. I think the incorrect sentence is Answer 2 uses HEAD to indicate the latest. This does not mean that that answer is wrong. It's explaining why there are two different solutions, however it is not true that it uses HEAD. It _is_true that answer 3 is not correct, for the reason explained there.

@novica
Copy link
Contributor Author

novica commented Oct 23, 2024

so from:

Answer 2 uses HEAD to indicate the latest.

to:

Answer 2 uses the index (staging area) to restore the file to previous version.

But, the question is: Which commands below will let her recover the last committed version .

$ git status
On branch main
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   bla.txt

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)
        modified:   bla.txt

$ git log
commit d3ed87b6d0d786c4c3a4617bfbab011ff7c05881 (HEAD -> main)
Author: novica <>
Date:   Wed Oct 23 14:56:47 2024 +0200

    1
$ git restore bla.txt 
$ git status
On branch main
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   bla.txt

And git restore then gets me back to the staged state of the repo, not the commited.

But maybe I am misunderstanding something.

github-actions bot pushed a commit that referenced this issue Oct 25, 2024
Auto-generated via `{sandpaper}`
Source  : 98cd1a3
Branch  : main
Author  : Martino Sorbaro <[email protected]>
Time    : 2024-10-25 08:51:16 +0000
Message : Merge pull request #1030 from novica/issue-1026

fix: resolve #1025
github-actions bot pushed a commit that referenced this issue Oct 25, 2024
Auto-generated via `{sandpaper}`
Source  : 2b287e8
Branch  : md-outputs
Author  : GitHub Actions <[email protected]>
Time    : 2024-10-25 08:52:08 +0000
Message : markdown source builds

Auto-generated via `{sandpaper}`
Source  : 98cd1a3
Branch  : main
Author  : Martino Sorbaro <[email protected]>
Time    : 2024-10-25 08:51:16 +0000
Message : Merge pull request #1030 from novica/issue-1026

fix: resolve #1025
github-actions bot pushed a commit to UCL-ARC/git-novice-vscode that referenced this issue Oct 25, 2024
Auto-generated via `{sandpaper}`
Source  : 98cd1a3
Branch  : main
Author  : Martino Sorbaro <[email protected]>
Time    : 2024-10-25 08:51:16 +0000
Message : Merge pull request swcarpentry#1030 from novica/issue-1026

fix: resolve swcarpentry#1025
github-actions bot pushed a commit to UCL-ARC/git-novice-vscode that referenced this issue Oct 25, 2024
Auto-generated via `{sandpaper}`
Source  : fe8a284
Branch  : md-outputs
Author  : GitHub Actions <[email protected]>
Time    : 2024-10-25 11:25:32 +0000
Message : markdown source builds

Auto-generated via `{sandpaper}`
Source  : 98cd1a3
Branch  : main
Author  : Martino Sorbaro <[email protected]>
Time    : 2024-10-25 08:51:16 +0000
Message : Merge pull request swcarpentry#1030 from novica/issue-1026

fix: resolve swcarpentry#1025
@novica
Copy link
Contributor Author

novica commented Oct 25, 2024

@martinosorb I think this got closed automatically because I misstyped the issue number in the PR for #1026

Can you have a look?

@martinosorb martinosorb reopened this Oct 28, 2024
github-actions bot pushed a commit to UCL-ARC/git-novice-vscode that referenced this issue Oct 29, 2024
Auto-generated via `{sandpaper}`
Source  : fe8a284
Branch  : md-outputs
Author  : GitHub Actions <[email protected]>
Time    : 2024-10-25 11:25:32 +0000
Message : markdown source builds

Auto-generated via `{sandpaper}`
Source  : 98cd1a3
Branch  : main
Author  : Martino Sorbaro <[email protected]>
Time    : 2024-10-25 08:51:16 +0000
Message : Merge pull request swcarpentry#1030 from novica/issue-1026

fix: resolve swcarpentry#1025
github-actions bot pushed a commit to UCL-ARC/git-novice-vscode that referenced this issue Nov 5, 2024
Auto-generated via `{sandpaper}`
Source  : fe8a284
Branch  : md-outputs
Author  : GitHub Actions <[email protected]>
Time    : 2024-10-25 11:25:32 +0000
Message : markdown source builds

Auto-generated via `{sandpaper}`
Source  : 98cd1a3
Branch  : main
Author  : Martino Sorbaro <[email protected]>
Time    : 2024-10-25 08:51:16 +0000
Message : Merge pull request swcarpentry#1030 from novica/issue-1026

fix: resolve swcarpentry#1025
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