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

Consider replacing "checkout" with "switch" and "restore", if widely available in the future #691

Open
twitwi opened this issue Sep 17, 2019 · 8 comments · May be fixed by #760
Open

Consider replacing "checkout" with "switch" and "restore", if widely available in the future #691

twitwi opened this issue Sep 17, 2019 · 8 comments · May be fixed by #760

Comments

@twitwi
Copy link
Contributor

@twitwi twitwi commented Sep 17, 2019

git checkout has been confusing for learners (especially when they later discover branching), see #169 for a first episode of this discussion.

This summer 2019, git started an experimental feature to solve this issue replacing it with two commands git restore and git switch
https://github.blog/2019-08-16-highlights-from-git-2-23/#experimental-alternatives-for-git-checkout

I though this was interesting to share, if people want to try the feature and/or push for its adoptions and/or start thinking about how the lessons might need to be modified.

Cheers.

@peterjc
Copy link

@peterjc peterjc commented Sep 24, 2019

Was about to open an issue on this (currently helping during a git session), seems worth considering.

@joaander
Copy link

@joaander joaander commented Oct 14, 2019

I agree, the new switch and restore commands clearly separate two different tasks into separate commands and will reduce cognitive load on students. I am now using these new commands regularly in my daily work.

However, it will be some time before git 2.23 is generally available to Carpentries workshop students. The workshop template suggests downloading the latest version (currently 2.23) of git on Windows and Mac from the web, and on Linux via their OS's package manager. Ubuntu 18.04 LTS is one popular distribution of Linux which only includes git 2.17. Hopefully, the next LTS release of Ubuntu (20.04 - April 2020) will include git 2.23 or newer, but it may be some time after that before typical Linux systems used by Carpentries students have 2.23 or newer available. Does the Carpentries survey what linux distros students utilize? That information could be helpful in making the decision when to update this content.

I do not plan to submit a PR at this time as it is too early to make the change. Here are the places in the lessons that can be changed once git >=2.23 is generally available.

  • 05-history.md - use git restore throughout. Additionally, the warning section "Don’t Lose Your HEAD" can be removed as git restore now only restores files. Even git switch <hash> would not result in this behavior, users need to explicitly opt-in to a detached HEAD with git switch --detach <hash>
  • 07-github.md - Remove the reference to git checkout ID. The proper command would be git switch --detach <hash> which has not been taught in prior lessons.
  • 09-conflict.md - The solution to "Conflicts on Non-textual files" should use git restore instead of git checkout.

The lesson does not teach branching, so git switch is not needed at all.

@katrinleinweber
Copy link
Contributor

@katrinleinweber katrinleinweber commented Nov 13, 2019

GitForWindows.org is now >2.24. In case you want to add a call-out in the meantime, please feel free to cherry-pick (and adapt) the commit below. Because it's in a fork customised to render from GitLab, I'll not start a PR.

katrinleinweber pushed a commit to katrinleinweber/git-novice that referenced this issue Nov 18, 2019
@chendaniely
Copy link
Contributor

@chendaniely chendaniely commented Mar 4, 2020

I've been teaching git (outside of carpentries related work) and people will still show up with an older version of git even if they're given the setup instructions. but it may be a good idea to still mention checkout as people transition to switch and restore.

One suggestion is to show switch and restore by default, but put in a grey box for the older checkout materials. it's going to take a while before switch and restore hit top StackOverflow solutions, so it may seem worthwhile to keep both sets of commands in the written lesson, but only teach the newer set of functions.

@jat255 jat255 linked a pull request that will close this issue Oct 6, 2020
@zingale
Copy link
Contributor

@zingale zingale commented Oct 11, 2020

I just ran into this today, teaching the git lesson. The lessons refer to checkout, but the output from the git commands refer to restore. Maybe it is time for this change?

@kekoziar
Copy link
Contributor

@kekoziar kekoziar commented Oct 12, 2020

@zingale git restore is still experimental

@zingale
Copy link
Contributor

@zingale zingale commented Oct 13, 2020

thanks for the response. I guess the bit that was confusing is that as I was sharing my screen and demonstrating it, the message that git gives on my computer says to use "restore", which contradicts what is in the lesson text. So it can be a source of confusion for participants.

@kekoziar
Copy link
Contributor

@kekoziar kekoziar commented Jul 23, 2021

I'm adding statuses "blocked" and "Refer to Curriculum Advisory Committee" because right now the features of restore and switch are still listed as experimental. As much as I would love to just implement the change in our curriculum, I think feedback and discussion are needed to establish guidelines before implementing changes to include experimental features that may change and/or go away. While I do not think these will change or go away, how we react to them establishes precedent for maintenance of the lesson.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

7 participants