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

Exploring History actually involves losing a change #352

Open
lexnederbragt opened this Issue Oct 25, 2016 · 2 comments

Comments

Projects
None yet
5 participants
@lexnederbragt
Member

lexnederbragt commented Oct 25, 2016

05-history Exploring History starts by adding another line to mars.txt:

An ill-considered change

but erroneously only lists that new line in the output of the first diff. This change is never committed.

Later, mars.txt is overwritten and then recovered from the current HEAD. In effect, this deletes the "An ill-considered change" line from the file.

Solution could be to rewrite the first part of 05-history to not add another change.

@billsacks

This comment has been minimized.

Contributor

billsacks commented Jan 18, 2017

I would suggest a different set of fixes for this problem:

  1. Keep the first part of 05-history, adding the "ill-considered change"

  2. After introducing git diff HEAD mars.txt, describe the two-commit version of git diff. I rarely want to compare my dirty working copy with some previous commit, so I think it would be more useful to explain the HEAD~1 syntax in the context of diffing two commits.

    So in place of git diff HEAD~1 mars.txt we'd have git diff HEAD~1 HEAD mars.txt - whose output matches what's currently shown. Similarly, in place of git diff HEAD~2 mars.txt we'd have git diff HEAD~2 HEAD mars.txt. And similarly for following diffs that use SHAs to identify the commits.

  3. When it gets to now how can we restore older versions of things? skip the part about overwriting the file: There are already undesirable changes in our working copy, so we should rework the example to explicitly illustrate undoing the An ill-considered change line.

martinosorb added a commit to martinosorb/git-novice that referenced this issue Dec 14, 2018

@martinosorb martinosorb referenced a pull request that will close this issue Dec 14, 2018

Open

Fixes #352 removing unnecessary update to mars.txt #581

@martinosorb

This comment has been minimized.

martinosorb commented Dec 14, 2018

Hi all! PR #581 fixes the bug following points 1 and 3 raised by @billsacks. I left point 2 open to further debate for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment