A repo was tagged, then some files were removed. Are those removed files still available for cloning (downloading) at the tagged version?
Let's elaborate the question a little bit more. My project is fully functional, I version-tagged its GitHub repo with “v1.0.0”
. I continue working on this project. In the process, I have made some modules at v1.0.0
obsolete, and I removed these. At a later date, I clone tag v1.0.0
to my local machine; do I actually have the modules that were removed?
Disclaimer
- I take no responsibilities for any damages or losses resulting from applying the procedures outlined in this post.
-- The answer is yes; the removed files associated with version-tagged v1.0.0
is still available. My verification attempts are discussed below.
✿✿✿
❶ I created a new repo https://github.com/behai-nguyen/learn-git.git
; my local working directory is D:\learn-git
, there are two (2) files in this directory 01-mysqlconnector.py
and 02-mysqlclient.py
.
⓵ Initialise the repo and check the two (2) files in:
git init
git config user.name "behai-nguyen"
git config user.email "behai_nguyen@hotmail.com"
git add .
git commit -m "Two (2) files to be tagged v1.0.0."
git branch -M main
git remote add origin https://github.com/behai-nguyen/learn-git.git
git push -u origin main
⓶ Version-tag the repo with v1.0.0
:
git tag -a v1.0.0 -m "First version: 01-mysqlconnector.py and 02-mysqlclient.py."
git push origin --tags
My local working directory D:\learn-git
and my repo:
❷ Remove 01-mysqlconnector.py
from my local directory, and repo:
git rm -f 01-mysqlconnector.py
git commit -m "Obsolete."
git branch -M main
git push -u origin main
Manually verify that it was removed from both local directory and repo.
❸ Now, clone version-tagged v1.0.0
to ascertain if 01-mysqlconnector.py
is still available. My working drive is E:
, and it should not have directory learn-git
:
git clone -b v1.0.0 https://github.com/behai-nguyen/learn-git.git
01-mysqlconnector.py
is still available for version-tagged v1.0.0
:
❹ Now add a new file 03-pymysql.py
, and then create a new version-tag v1.0.1
.
⓵ Add the new file 03-pymysql.py
, the working directory is D:\learn-git
:
git add 03-pymysql.py
git commit -m "Test package pymysql."
git push -u origin main
⓶ Create the new version-tag v1.0.1
:
git tag -a v1.0.1 -m "Second version: 02-mysqlclient.py and 03-pymysql.py."
git push origin --tags
❺ At this point:
⓵ With clone command for v1.0.0
:
git clone -b v1.0.0 https://github.com/behai-nguyen/learn-git.git
We should get:
01-mysqlconnector.py
02-mysqlclient.py
⓶ While downloading v1.0.1
:
git clone -b v1.0.1 https://github.com/behai-nguyen/learn-git.git
We should get:
02-mysqlclient.py
03-pymysql.py
I needed to know this for myself. I hope you find this useful as I do. Thank you for reading and stay safe as always.
Top comments (0)