DEV Community

Cover image for GitHub: are removed version-tagged files still available for downloading?
Be Hai Nguyen
Be Hai Nguyen

Posted on

GitHub: are removed version-tagged files still available for downloading?

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
Enter fullscreen mode Exit fullscreen mode

⓶ 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
Enter fullscreen mode Exit fullscreen mode

My local working directory D:\learn-git and my repo:

052-01.png

❷ 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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

01-mysqlconnector.py is still available for version-tagged v1.0.0:

052-02.png

❹ 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
Enter fullscreen mode Exit fullscreen mode

⓶ 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
Enter fullscreen mode Exit fullscreen mode

❺ At this point:

⓵ With clone command for v1.0.0:

git clone -b v1.0.0 https://github.com/behai-nguyen/learn-git.git
Enter fullscreen mode Exit fullscreen mode

We should get:

  1. 01-mysqlconnector.py
  2. 02-mysqlclient.py

⓶ While downloading v1.0.1:

git clone -b v1.0.1 https://github.com/behai-nguyen/learn-git.git
Enter fullscreen mode Exit fullscreen mode

We should get:

  1. 02-mysqlclient.py
  2. 03-pymysql.py

052-03.png

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)