GitHub: are removed version-tagged files still available for downloading?
Tags: github, tag, clone, remove
Published: 2023-01-04 06:48:27

*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 <code>“v1.0.0”</code>. I continue working on this project. In the process, I have made some modules at <code>v1.0.0</code> obsolete, and I removed these. At a later date, I clone tag <code>v1.0.0</code> 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. 

<strong>-- The answer is yes; the removed files associated with version-tagged <code>v1.0.0</code> is still available.</strong> My verification attempts are discussed below.

✿✿✿

❶ I created a new repo <code>https://github.com/behai-nguyen/learn-git.git</code>; my local working directory is <code>D:\learn-git</code>, there are two (2) files in this directory <code>01-mysqlconnector.py</code> and <code>02-mysqlclient.py</code>.

⓵ 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 <code>v1.0.0</code>:

```
git tag -a v1.0.0 -m "First version: 01-mysqlconnector.py and 02-mysqlclient.py."
git push origin --tags
```

My local working directory <code>D:\learn-git</code> and my repo:

![052-01.png](https://behainguyen.files.wordpress.com/2023/01/052-01.png)

❷ Remove <code>01-mysqlconnector.py</code> 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 <code>v1.0.0</code> to ascertain if <code>01-mysqlconnector.py</code> is still available. My working drive is <code>E:</code>, and it <strong>should not have directory <code>learn-git</code></strong>:

```
git clone -b v1.0.0 https://github.com/behai-nguyen/learn-git.git
```

<code>01-mysqlconnector.py</code> is still available for version-tagged <code>v1.0.0</code>:

![052-02.png](https://behainguyen.files.wordpress.com/2023/01/052-02.png)

❹ Now add a new file <code>03-pymysql.py</code>, and then create a new version-tag <code>v1.0.1</code>.

⓵ Add the new file <code>03-pymysql.py</code>, the working directory is <code>D:\learn-git</code>:

```
git add 03-pymysql.py
git commit -m "Test package pymysql."
git push -u origin main
```

⓶ Create the new version-tag <code>v1.0.1</code>:

```
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 <code>v1.0.0</code>:

```
git clone -b v1.0.0 https://github.com/behai-nguyen/learn-git.git
```

We should get:

<ol>
<li style="margin-top:10px;"><code>01-mysqlconnector.py</code></li>
<li style="margin-top:10px;"><code>02-mysqlclient.py</code></li>
</ol>

⓶ While downloading <code>v1.0.1</code>:

```
git clone -b v1.0.1 https://github.com/behai-nguyen/learn-git.git
```

We should get:

<ol>
<li style="margin-top:10px;"><code>02-mysqlclient.py</code></li>
<li style="margin-top:10px;"><code>03-pymysql.py</code></li>
</ol>

![052-03.png](https://behainguyen.files.wordpress.com/2023/01/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.