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

The "git checkout" mess - understanding #169

Closed
twitwi opened this Issue Aug 4, 2015 · 8 comments

Comments

Projects
None yet
5 participants
@twitwi
Contributor

twitwi commented Aug 4, 2015

I recently watched my co-instructor teach the first part of the git lesson and I now understand why @gvwilson feels git is very inappropriate for beginners. I feel that git checkout is very confusing for learners and could probably be skipped.

I drafted a post-workshop blog post, available there http://home.heeere.com/teach-swc-cern-201507.html
(see the section named The “git checkout” Mess-Understanding).

I'd like to see what people feel about git checkout.
Here are the main arguments against it: confusing, dangerous (detached head mess), not-so-useful, replaceable.

@twitwi

This comment has been minimized.

Show comment
Hide comment
@twitwi

twitwi Aug 4, 2015

Contributor

It is probably too late to have an impact on #155 but the discussion is worth having.
(let me know if this discussion already happened and I missed it)

Contributor

twitwi commented Aug 4, 2015

It is probably too late to have an impact on #155 but the discussion is worth having.
(let me know if this discussion already happened and I missed it)

@rgaiacs

This comment has been minimized.

Show comment
Hide comment
@rgaiacs

rgaiacs Aug 5, 2015

Contributor

It is probably too late to have an impact on #155 but the discussion is worth having.

Isn't too late. We will delay 5.4 so we can include this on it. =)

(let me know if this discussion already happened and I missed it)

You didn't missed it. And thanks to bring it up.

git checkout is confusing, dangerous (detached head mess), not-so-useful, replaceable.

I agree that it is a lot confusing and dangerous (because of detached head).

I disagree with not-so-useful, replaceable. If you want to check if something works or not on a previous version you will need to use git checkout and git show VERSION:file/name will not help you very much.

Contributor

rgaiacs commented Aug 5, 2015

It is probably too late to have an impact on #155 but the discussion is worth having.

Isn't too late. We will delay 5.4 so we can include this on it. =)

(let me know if this discussion already happened and I missed it)

You didn't missed it. And thanks to bring it up.

git checkout is confusing, dangerous (detached head mess), not-so-useful, replaceable.

I agree that it is a lot confusing and dangerous (because of detached head).

I disagree with not-so-useful, replaceable. If you want to check if something works or not on a previous version you will need to use git checkout and git show VERSION:file/name will not help you very much.

@daisieh

This comment has been minimized.

Show comment
Hide comment
@daisieh

daisieh Aug 5, 2015

Contributor

Personally, I think git checkout is very important, as it sets the foundation for branching, which they'll learn sooner or later, even if not at the bootcamp. I think it's better to actually create a detached head as part of the lesson and discuss how to get back to the normal state. I teach it like this: https://github.com/daisieh/git-novice/blob/2015-07-24-lsiubc/06-collab.md

Contributor

daisieh commented Aug 5, 2015

Personally, I think git checkout is very important, as it sets the foundation for branching, which they'll learn sooner or later, even if not at the bootcamp. I think it's better to actually create a detached head as part of the lesson and discuss how to get back to the normal state. I teach it like this: https://github.com/daisieh/git-novice/blob/2015-07-24-lsiubc/06-collab.md

@gvwilson gvwilson changed the title from The “git checkout” Mess-Understanding to The "git checkout" mess - understanding Aug 6, 2015

@twitwi

This comment has been minimized.

Show comment
Hide comment
@twitwi

twitwi Aug 6, 2015

Contributor

To clarify my point, I think git checkout is very important (to switch and create branches) but I would avoid it to recover individual files.

@daisieh thanks for sharing you tuning of the lesson, the detached head may indeed be a good time to introduce branches. Prior to teaching software carpentry, I actually introduced (local) branching before remote collaboration, so branching was a natural step.

Contributor

twitwi commented Aug 6, 2015

To clarify my point, I think git checkout is very important (to switch and create branches) but I would avoid it to recover individual files.

@daisieh thanks for sharing you tuning of the lesson, the detached head may indeed be a good time to introduce branches. Prior to teaching software carpentry, I actually introduced (local) branching before remote collaboration, so branching was a natural step.

@iglpdc

This comment has been minimized.

Show comment
Hide comment
@iglpdc

iglpdc Aug 10, 2015

Contributor

I also agree it's very confusing. I would like to avoid any reference to branches because the lesson is already packed.

People is really interested on how to undo things. I'd say the first things we have to cover are how to undo changes in the working dir, how to unstage, and how to go throw away a committed change. @gvwilson proposed to add information on how to undo in #88.

Do you think that we can introduce git reset to go back to a previous version without complicating to much the lesson? Maybe we could:

  • introduce git checkout -- filename to undo unstaged changes,
  • introduce git reset commit-id to go back to previous versions, which includes unstaging,
  • skip the current git checkout commit-id filename.

This way we could avoid the the discussion on the detached head.

Contributor

iglpdc commented Aug 10, 2015

I also agree it's very confusing. I would like to avoid any reference to branches because the lesson is already packed.

People is really interested on how to undo things. I'd say the first things we have to cover are how to undo changes in the working dir, how to unstage, and how to go throw away a committed change. @gvwilson proposed to add information on how to undo in #88.

Do you think that we can introduce git reset to go back to a previous version without complicating to much the lesson? Maybe we could:

  • introduce git checkout -- filename to undo unstaged changes,
  • introduce git reset commit-id to go back to previous versions, which includes unstaging,
  • skip the current git checkout commit-id filename.

This way we could avoid the the discussion on the detached head.

@jttkim

This comment has been minimized.

Show comment
Hide comment
@jttkim

jttkim Aug 10, 2015

Based on my own practice I think this makes sense. I use git checkout fairly regularly to get back to a sane state after having done something that turned out to be insane, git reset much less frequently, and I very rarely have to deal with detached head situations (and other states that are more or less logical consequences of git's design, but don't have any obvious analogies to general patterns of work).

So from my perspective dealing with detached heads is a use case that's rare enough to justify not covering it in detail.

Best regards, Jan

jttkim commented Aug 10, 2015

Based on my own practice I think this makes sense. I use git checkout fairly regularly to get back to a sane state after having done something that turned out to be insane, git reset much less frequently, and I very rarely have to deal with detached head situations (and other states that are more or less logical consequences of git's design, but don't have any obvious analogies to general patterns of work).

So from my perspective dealing with detached heads is a use case that's rare enough to justify not covering it in detail.

Best regards, Jan

@rgaiacs

This comment has been minimized.

Show comment
Hide comment
@rgaiacs

rgaiacs Aug 10, 2015

Contributor

Do you think that we can introduce git reset to go back to a previous version without complicating to much the lesson? Maybe we could:

  • introduce git checkout -- filename to undo unstaged changes,
  • introduce git reset commit-id to go back to previous versions, which includes unstaging,
  • skip the current git checkout commit-id filename.

When I'm teaching Git

  • I normally mention git checkout REVISION -- filename to undo changes,
    i.e. recovering one file.

I don't use git checkout REVISION filename or git checkout REVISION
to avoid detached head.

  • When I'm explaining "working copy", "stage copy" and "save copy"
    I explain git reset HEAD -- filename so that students could unstage files.

I don't mention others use of reset.

  • Except if one student ask about branch I don't mention it.
Contributor

rgaiacs commented Aug 10, 2015

Do you think that we can introduce git reset to go back to a previous version without complicating to much the lesson? Maybe we could:

  • introduce git checkout -- filename to undo unstaged changes,
  • introduce git reset commit-id to go back to previous versions, which includes unstaging,
  • skip the current git checkout commit-id filename.

When I'm teaching Git

  • I normally mention git checkout REVISION -- filename to undo changes,
    i.e. recovering one file.

I don't use git checkout REVISION filename or git checkout REVISION
to avoid detached head.

  • When I'm explaining "working copy", "stage copy" and "save copy"
    I explain git reset HEAD -- filename so that students could unstage files.

I don't mention others use of reset.

  • Except if one student ask about branch I don't mention it.
@twitwi

This comment has been minimized.

Show comment
Hide comment
@twitwi

twitwi Sep 24, 2015

Contributor

I'm closing this as this is not so important.

Contributor

twitwi commented Sep 24, 2015

I'm closing this as this is not so important.

@twitwi twitwi closed this Sep 24, 2015

ErinBecker pushed a commit to ErinBecker/git-novice-es that referenced this issue Feb 13, 2018

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