Git

Browse posts by tag

GitHub - Delete a Tag

January 13, 2026

To delete a tag from the LOCAL:

(.venv) coo:~/Documents/DevOps/GCS-Cloud$ git tag -d v1.0
Deleted tag 'v1.0' (was 6655ed0)
(.venv) coo:~/Documents/DevOps/GCS-Cloud$ git tag -d v1.0.0 
Deleted tag 'v1.0.0' (was ab35d04)
(.venv) coo:~/Documents/DevOps/GCS-Cloud$ git tag      
2.0
show

To delete a tag from the REMOTE:

# For example, to delete the v1.0 and v1.0.0 tags from remote:
git push origin --delete v1.0
git push origin --delete v1.0.0

# Check the remote tags again
git ls-remote --tags origin

Note that while the tags were deleted locally, they still appear in the remote repository when using “git ls-remote –tags origin”. The “git tag” command only displays tags that exist in your local repository.

GitHub - Create a Tag

January 13, 2026

1. Displaying Git Tags

(.venv) coo:~/Documents/DevOps/GCS-Cloud$ git tag
2.0
show
v1.0
v1.0.0

2. Check out the main branch

git checkout main

3. Check the commit hash of main branch (last update)

# Show the latest commit on main (from remote)
git fetch origin
git log origin/main -1
# For example
PS C:\code\Quick-Installer> git log origin/main -1
commit 87b1cfd5fae54d85f9c1a77b134092fb9ed624a3 (origin/main, origin/HEAD)
Merge: ea44cbc 4195693
Author: gituser <[email protected]>
Date:   Mon Sep 15 15:59:32 2025 +1000

    Merge pull request #7 from gituser/patch/backward-compatibility

    fixed confi file downlaod issue

4. Create the tag

git tag v.3.3.2 87b1cfd5fae54d85f9c1a77b134092fb9ed624a3

5. Push the tag to remote

git push origin v3.3.2

6. Verify

git show v3.3.2

Display tags with detailed information

(.venv) coo:~/Documents/DevOps/GCS-Cloud$ git ls-remote --tags origin
90e2de33d27de3116195bfe26dde6d750191889d        refs/tags/2.0
6655ed0a66e4b9fa141d5aa87ffd9c10fdfdc603        refs/tags/v1.0
ab35d0488d9e8b0a66502a0e900538449dc7190d        refs/tags/v1.0.0
47ecf4f18119d628cc3f61932c9d81d25690630c        refs/tags/v1.0.0^{}

See also:

GitHub - Create a New Repo

GitHub - Clean a Branch

January 13, 2026

After merging, we may still see the release branch like this

(.venv) coo:~/Documents/DevOps/GCS-Cloud$ git branch -a
  develop
* main
  release/2.0
  remotes/origin/HEAD -> origin/main
  remotes/origin/develop
  remotes/origin/feature/witt_test
  remotes/origin/main
  remotes/origin/release/2.0

After running “git fetch –prune”, the remote branch was updated but the local branch remained unchanged.

(.venv) coo:~/Documents/DevOps/GCS-Cloud$ git fetch --prune
From https://dev.azure.com/nobuops/GCS-Cloud/_git/GCS-Cloud
 - [deleted]         (none)     -> origin/release/2.0
remote: Azure Repos
remote: Found 1 objects to send. (0 ms)
Unpacking objects: 100% (1/1), 328 bytes | 82.00 KiB/s, done.
   47ecf4f..90e2de3  main       -> origin/main
(.venv) coo:~/Documents/DevOps/GCS-Cloud$ git branch -a
  develop
* main
  release/2.0
  remotes/origin/HEAD -> origin/main
  remotes/origin/develop
  remotes/origin/feature/witt_test
  remotes/origin/main

To clean up the repository completely, manually delete the local branch

GitHub - Pull Request (Azure DevOps)

January 13, 2026

This guide shows how to push changes from the feature/script-update-for-multi-regsions branch to the develop branch in Azure DevOps


Step 1: Ensure all the changes are committed to the feature branch.

# Check the current branch
(.venv) coo:~/Documents/DevOps/GCS-Cloud/base$ git branch
  develop
* feature/script-update-for-multi-regsions
  main
  
# Check the status of the local repository
(.venv) coo:~/Documents/DevOps/GCS-Cloud/base$ git status
On branch feature/script-update-for-multi-regsions
nothing to commit, working tree clean

Step 2: Use Azure DevOps Web UI

  1. Go to your Azure DevOps project in the browser.

GitHub - Pull Latest Change

January 13, 2026

Option 1: Stash your changes (temporarily save)

If you’re not ready to commit, but want to pull the latest code:

git stash
git pull
git stash pop
  • git stash temporarily saves your changes
  • git pull fetches and merges the latest version
  • git stash pop restores your changes

Option 2: Discard your changes

⚠️ Only do this if you’re okay with losing your local changes:

git reset --hard origin/develop
git pull

See also:

GitHub - Create a New Repo

GitHub - Create a New Branch

January 13, 2026

This is an example to create “develop” branch from copying from “main” branch. We can apply the same steps for creating “feature” branch and “release” branch


1. Ensure your repository is clean

git status
git branch -a

2. Preparation before creating a new branch

git checkout {ORIGINAL BRANCH} (e.g, main)
git pull origin {ORIGINAL BRANCH} (e.g, main)

3. Create the new branch locally

git checkout -b {NEW BRANCH} (e.g, develop)

# Sample of feature branch
git checkout -b feature/new_feature_branch_name

# Sample of release branch
git checkout -b release/new_release_branch_name

4. Push the new branch to GitHub

git push -u origin {NEW BRANCH} (e.g, develop)

5. Verify both branches exist

Run:

GitHub - SSH Settings (ed25519)

January 10, 2026

This workflow ensures:

  • Secure key (with passphrase)
  • Convenient usage (Keychain remembers passphrase)
  • SSH-only workflow → no HTTPS credentials required

1) Check for existing keys (optional)

ls -la ~/.ssh
  • Look for id_ed25519 / id_ed25519.pub
  • If you already have a key you want to use, skip key generation

2) Generate a new ed25519 key

ed25519 refers to the Ed25519 elliptic-curve algorithm, which is the modern, faster, and more secure replacement for older RSA SSH keys. Replace the email with your GitHub email:

What Is Zone Identifier

December 21, 2025

  • What it is

    Zone.Identifier is Windows-only metadata stored as an NTFS Alternate Data Stream (ADS).

  • Why it exists

    Windows uses it to mark files downloaded from the Internet for security purposes.

  • Why it appears on macOS/Linux

    NTFS ADS is hidden on Windows, but when files are copied, zipped, or committed to Git and then opened on non-Windows systems, the metadata becomes a visible file:

    filename:Zone.Identifier
    
  • Is it dangerous?

    ❌ No.

GitHub - Reset and Start Again

June 25, 2025

📥 How to Reset and Start Again

Method 1: Reset your current branch

This will discard all local changes and make the local branch exactly match the remote.

# First, make sure you're on the right branch
git checkout release/v3.1.0

# Fetch the latest changes from remote
git fetch origin

# Reset your local branch to match the remote version
git reset --hard origin/release/v3.1.0

Method 2: Fresh checkout (if you want to start completely fresh)

# First, move to a safe location (if you have unsaved work)
git stash

# Then checkout the release branch, forcing a clean copy
git checkout -f release/v3.1.0

# Update to the latest version from remote
git pull origin release/v3.1.0

⚠️ Note: Both methods will discard any uncommitted changes! If you have work you want to keep, commit it to a temporary branch first:

GitHub - Best Practive Tagging

June 25, 2025

Daily Git Workflow with Tag Strategy

1. Continue to work on the feature branch

git checkout feature/v3.2.0
git pull origin feature/v3.2.0

2. Commit stable changes

git add .
git commit -m "Fixed export timeout issue"

3. Tag a stable version (optional, when ready)

# Use semantic versioning: v3.1.3, v3.1.4, etc.
# Tags point to the most recent commit.
git tag v3.1.2

4. Push your changes and tag to GitHub

git push origin feature/v3.2.0
git push origin v3.1.2

5. Verify your tag (if needed)

git tag                         # List local tags
git show v3.1.2                 # Show details of the tag
git branch --contains v3.1.2    # See which branch includes it

Bonus (Optional Advanced Commands)

  • List tags sorted by date (most recent first):

Git - Move Branch

May 20, 2025

Move to “master”

Open the terminal (press Ctrl+`) and run:

git checkout master

If master isn’t checked out locally yet, do:

git fetch origin
git checkout master

If “master” was not updated in the local branch

If the branch switched successfully to master, but the files in your working directory didn’t update as expected, it could be one of these cases:

  1. Confirm You’re on the Correct Branch Run this to verify:
git branch

You should see something like this. The asterisk * indicates your current branch.

Azure DevOps - Complete (Merge)

May 20, 2025

Use Azure DevOps Web UI

Scenario:

This guide shows how to merge a pull request from the release/v1.0-america branch into the main branch using Azure DevOps or any Git repository.

Final Step (Complete the Pull Request):

  1. Once it’s approved, click the “Complete” button to merge it into master.

  2. You’ll get options like:

    • Squash or merge (depending on settings)
    • Delete source branch after merging (optional)
  3. Click “Complete merge” when ready

Azure DevOps - Approve

May 20, 2025

Use Azure DevOps Web UI

Scenario:

This guide demonstrates how to approve a pull request from the release/v1.0-america branch into the master branch in Azure DevOps or any Git repository.

Steps (Approve the Pull Request):

  1. Go to Azure DevOps in your browser
  2. Navigate to Repos > Pull Requests

  1. Find the Pull request (from release/v1.0-america to master)
  2. Click on the PR to open it.
  3. On the right-hand side, you’ll see the “Reviewers” section

Azure DevOps - Pull Request

May 20, 2025

Use Azure DevOps Web UI

Scenario:

This guide shows how to push changes from the release/v1.0-america branch to the master branch in Azure DevOps (or any Git repository).


Steps:

  1. Go to your Azure DevOps project in the browser.
  2. Navigate to Repos > Branches.
  3. Find your branch release/v1.0-america
  4. Click on the "…" (More options) next to it and select “New pull request”

  1. Set:

    • Source: release/v1.0-america
    • Target: master
  2. Add a title, description (optional but helpful), and click “Create”

Git - Ignore Settings

February 25, 2025

How to Ignore Uploading Folders and Files to GitHub

For example .venv folder

  1. Open your project folder in VS Code.

  2. Open .gitignore file in the root of the project

  3. Add the following line to .gitignore:

    .venv/
    
  4. Save the file. then Git will ignore the .venv folder, and it won’t be tracked in your repository.

If .venv was already committed before, you’ll need to remove it from Git history using:

git rm -r --cached .venv
git commit -m "Removed .venv from repository"
git push origin main  # or your current branch

You can check if .venv is ignored by Git using the following command