How do I manage multiple version on GIT

I want to upload some code to github.

That I can do this with (Let’s call this version 1.0):

echo "# oz" >> README.md
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/jen*/oz.git
git push -u origin master


But after i placed my code on github, made some changed and I want to push my code on github.

So I am capable of of uploading version 2.0 with:

git add .
git commit -m "second commit"
git remote add origin https://github.com/jen*/oz.git
git push

But how can I retrieve version 1.0 back again?
https://git-scm.com/book/en/v2/Git-Basics-Tagging

Or you can just look at the log and do 'git checkout <<commit-id>>'
Thank you, a question follow up:
How do I get a copy of version 1.0 (let's say I also modified in version 2.0 the README.MD) without harming version 2.0

So my first upload is like:

1
2
3
4
5
6
7
echo "# oz" >> README.md
git init
git add .
git tag 1.0
git commit -m "first commit"
git remote add origin https://github.com/jen*/oz.git
git push -u origin master


My second upload like:

1
2
3
4
5
6
echo "This is version two" >> added.txt
git add .
git commit -m "second commit"
git tag 2.0
git remote add origin https://github.com/jen*/oz.git
git push -u origin master

What do you mean 'harm'?

It's in git, so there is no harm to be done. You can go and look at any previous commit whenever you want, without damaging any other commit in your repo.

You want to look at version 1, then do
git checkout 1.0 
less README.md
git checkout master


Or even
git show 1.0:README.md


Thank you this is what I was looking for!
Registered users can post here. Sign in or register to post.