How do I manage multiple version on GIT
Sep 13, 2019 at 3:01pm UTC
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?
Sep 13, 2019 at 6:18pm UTC
Sep 14, 2019 at 5:42am UTC
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
Sep 14, 2019 at 6:29am UTC
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
Sep 14, 2019 at 7:14am UTC
Thank you this is what I was looking for!
Topic archived. No new replies allowed.