esciencecenter-digital-skills / git-lesson

Intro to Git and collaborative version control
https://esciencecenter-digital-skills.github.io/git-lesson/
Other
0 stars 0 forks source link

Strip off lesson materials that we do not teach #21

Open lyashevska opened 3 months ago

lyashevska commented 3 months ago

It is very hard to stay on time while teaching https://github.com/esciencecenter-digital-skills/git-lesson We should remove all unrelated/advanced stuff.

svenvanderburg commented 2 months ago

For episode 5 these are my notes:

Goal: Know that all commits are stored in your history. If you make a mess you can always go back, but you don’t have to remember the details how to do that exactly as long as you remember that it is possible! I will teach you a few important concepts and then you can google your way out of a mess!

image

Put the picture on the screen: There are 2 ways of referring to a commit: • Relative to HEAD, where HEAD is an identifier for the most recent commit • The commit ID -> a unique randomly assigned string, also called a commit hash So let’s say we want to see the differences between HEAD~2 and current state: • git diff HEAD~2 mars.txt • git log • git diff commit ID mars.txt • git show commit ID mars.txt -> to see the file of that version of the software Now let’s revert history • git checkout commit ID mars.txt -> to set staging area to version of that commit • git status • git checkout HEAD mars.txt -> to go to most recent commit Important: you never actually change history. You add another commit that changes the state to an older version. Do exercises individually!