Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
      • Pod
    • Helm Chart
    • OAuth2 Proxy
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Argo Events
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • DevSecOps
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
      • Azure Cloud
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log, Monitor & Tracing
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[Git] Check out the git-low application for your releases.

Posted on November 6, 2024November 6, 2024 By nim No Comments on [Git] Check out the git-low application for your releases.

Đầu tiên thì git flow … không có sẵn trong command git.
Chúng ta cần phải cài thêm

sudo apt install git-flow

chẳn hạn chúng ta sẽ tạo 1 feature liên quan user authentication

root@LE11-D7891:~/github/devsecops-laboratory# git flow feature start user-authentication
Fatal: Not a gitflow-enabled repo yet. Please run 'git flow init' first.

Vì đây là lần đầu tiên tôi sử dụng git flow nên tôi sẽ cần setup run git flow init
Nim chỉ có một chỗ hơi khó hiểu Version tag prefix?
nếu bạn khai báo chỗ này khai là v thì ở các bước sau:
Git flow hỏi muốn tạo tag gì?
Bạn trả lời 2.0.0
thì Git flow sẽ tạo 1 tag là v2.0.0 và push lên trên git

root@LE11-D7891:~/github/devsecops-laboratory# git flow init

Which branch should be used for bringing forth production releases?
   - develop
   - master
Branch name for production releases: [master]

Which branch should be used for integration of the "next release"?
   - develop
Branch name for "next release" development: [develop]

How to name your supporting branch prefixes?
Feature branches? [feature/]
Bugfix branches? [bugfix/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? [] v
Hooks and filters directory? [/root/github/devsecops-laboratory/.git/hooks]

Khi bạn run “git flow feature start helm-chart-add” nó sẽ tạo branch feature/helmchart-add từ branch develop và move workspace của bạn sang branch feature/helmchart-add

root@LE11-D7891:~/github/devsecops-laboratory# git flow feature start helm-chart-add
Switched to a new branch 'feature/helmchart-add'

Summary of actions:
- A new branch 'feature/helmchart-add' was created, based on 'develop'
- You are now on branch 'feature/helmchart-add'

Now, start committing on your feature. When done, use:

     git flow feature finish helmchart-add

root@LE11-D7891:~/github/devsecops-laboratory# git branch
  develop
* feature/helmchart-add
  master

Sau đó bạn dụng lệnh git flow feature publish helm-chart-add, nó sẽ push branch của bạn lên github và sau đó chuyển workspace của bạn sang branch feature/helmchart-add

git flow feature publish helm-chart-add

Ở bước này tôi thực hiện tạo file helmchart.md và code trong đó
tôi code xong git add và git commit.

root@LE11-D7891:~/github/devsecops-laboratory# vi helmchart.md
root@LE11-D7891:~/github/devsecops-laboratory# git branch
  develop
* feature/helmchart-add
  master
root@LE11-D7891:~/github/devsecops-laboratory# git status
On branch feature/helmchart-add
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   helmchart.md

no changes added to commit (use "git add" and/or "git commit -a")
root@LE11-D7891:~/github/devsecops-laboratory# git add .
root@LE11-D7891:~/github/devsecops-laboratory# git commit -m"complete add feature"
[feature/helmchart-add d973cf0] complete add feature
 1 file changed, 1 insertion(+)

Khi tôi thực hiện run git flow feature finish helmchart-add
Nó sẽ chuyển bạn sang branch develop.
merge code từ feature/helmchart-add sang develop

root@LE11-D7891:~/github/devsecops-laboratory# git flow feature finish helmchart-add
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
Updating 6fba75b..d973cf0
Fast-forward
 helmchart.md | 1 +
 1 file changed, 1 insertion(+)
Deleted branch feature/helmchart-add (was d973cf0).

Summary of actions:
- The feature branch 'feature/helmchart-add' was merged into 'develop'
- Feature branch 'feature/helmchart-add' has been locally deleted
- You are now on branch 'develop'

root@LE11-D7891:~/github/devsecops-laboratory# git branch
* develop
  master

Bạn thực hiện đồng bộ code trên master và develop ở local.

root@LE11-D7891:~/github/devsecops-laboratory# git checkout master && git pull
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Already up to date.
root@LE11-D7891:~/github/devsecops-laboratory# git checkout develop && git pull
Switched to branch 'develop'
Your branch is ahead of 'origin/develop' by 1 commit.
  (use "git push" to publish your local commits)
Already up to date.

Bạn run “git flow release start 2.0.0” nó sẽ tạo branch ‘release/2.0.0’ từ ‘develop’
Đưa bạn sang branch release/2.0.0

root@LE11-D7891:~/github/devsecops-laboratory# git flow release start 2.0.0
Branches 'develop' and 'origin/develop' have diverged.
And local branch 'develop' is ahead of 'origin/develop'.
Switched to a new branch 'release/2.0.0'

Summary of actions:
- A new branch 'release/2.0.0' was created, based on 'develop'
- You are now on branch 'release/2.0.0'

Follow-up actions:
- Bump the version number now!
- Start committing last-minute fixes in preparing your release
- When done, run:

     git flow release finish '2.0.0'

root@LE11-D7891:~/github/devsecops-laboratory# git branch
  develop
  master
* release/2.0.0

KHi bạn nhấn “git flow release publish 2.0.0” thì nó sẽ push code ở release/2.0.0 branch lên github.

root@LE11-D7891:~/github/devsecops-laboratory# git flow release publish 2.0.0
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 289 bytes | 289.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
remote:
remote: Create a pull request for 'release/2.0.0' on GitHub by visiting:
remote:      https://github.com/mrnim94/devsecops-laboratory/pull/new/release/2.0.0
remote:
To https://github.com/mrnim94/devsecops-laboratory.git
 * [new branch]      release/2.0.0 -> release/2.0.0
Branch 'release/2.0.0' set up to track remote branch 'release/2.0.0' from 'origin'.
Already on 'release/2.0.0'
Your branch is up to date with 'origin/release/2.0.0'.

Summary of actions:
- The remote branch 'release/2.0.0' was created or updated
- The local branch 'release/2.0.0' was configured to track the remote branch
- You are now on branch 'release/2.0.0'

Trong local bạn quay về kiểm tra và pull lại branch develop

root@LE11-D7891:~/github/devsecops-laboratory# git checkout develop; git push
Switched to branch 'develop'
Your branch is ahead of 'origin/develop' by 1 commit.
  (use "git push" to publish your local commits)
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/mrnim94/devsecops-laboratory.git
   6fba75b..d973cf0  develop -> develop

Trên github bạn thực hiện tạo Pull Request từ release/2.0.0 sang master

Sau đó bạn click merge Pull Request

Deploy the release branch to Staging and perform Staging

Khi bạn gõ: git flow release finish -Fp 2.0.0:

root@LE11-D7891:~/github/devsecops-laboratory# git checkout master && git pull
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Already up to date.
root@LE11-D7891:~/github/devsecops-laboratory# git checkout develop && git pull
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
Already up to date.
root@LE11-D7891:~/github/devsecops-laboratory# git checkout release/2.0.0 && git pull
Switched to branch 'release/2.0.0'
Your branch is up to date with 'origin/release/2.0.0'.
Already up to date.
 
 root@LE11-D7891:~/github/devsecops-laboratory# git flow release finish -Fp 2.0.0

Bạn có thêm dòng Release v2.0.0 – add…
Xong đó nhấn Ctrl + 0 -> enter -> Ctrl + X

Xong đó nhấn Ctrl + 0 -> enter -> Ctrl + X

Branches 'master' and 'origin/master' have diverged.
And local branch 'master' is ahead of 'origin/master'.
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
Already up to date!
Merge made by the 'recursive' strategy.
Enumerating objects: 2, done.
Counting objects: 100% (2/2), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 402 bytes | 402.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/mrnim94/devsecops-laboratory.git
   d973cf0..c27400d  develop -> develop
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/mrnim94/devsecops-laboratory.git
   d69a9cc..89fe713  master -> master
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100% (1/1), 218 bytes | 218.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To https://github.com/mrnim94/devsecops-laboratory.git
 * [new tag]         v2.0.0 -> v2.0.0
To https://github.com/mrnim94/devsecops-laboratory.git
 - [deleted]         release/2.0.0
Deleted branch release/2.0.0 (was d973cf0).

Summary of actions:
- Latest objects have been fetched from 'origin'
- Release branch 'release/2.0.0' has been merged into 'master'
- The release was tagged 'v2.0.0'
- Release tag 'v2.0.0' has been back-merged into 'develop'
- Release branch 'release/2.0.0' has been locally deleted; it has been remotely deleted from 'origin'
- 'develop', 'master' and tags have been pushed to 'origin'
- You are now on branch 'develop'

Code từ branch ‘release/2.0.0’ được merge vào master
tạo tag v2.0.0 và push lên GitHub
Code của tag v2.0.0 được merge vào devlop
branch release/2.0.0 được xóa

Hotfix branch

root@LE11-D7891:~/github/devsecops-laboratory# git checkout master && git pull
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Already up to date.
root@LE11-D7891:~/github/devsecops-laboratory# git flow hotfix start 2.0.1
Switched to a new branch 'hotfix/2.0.1'

Summary of actions:
- A new branch 'hotfix/2.0.1' was created, based on 'master'
- You are now on branch 'hotfix/2.0.1'

Follow-up actions:
- Start committing your hot fixes
- Bump the version number now!
- When done, run:

     git flow hotfix finish '2.0.1'
root@LE11-D7891:~/github/devsecops-laboratory# git flow hotfix publish 2.0.1
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for 'hotfix/2.0.1' on GitHub by visiting:
remote:      https://github.com/mrnim94/devsecops-laboratory/pull/new/hotfix/2.0.1
remote:
To https://github.com/mrnim94/devsecops-laboratory.git
 * [new branch]      hotfix/2.0.1 -> hotfix/2.0.1
Branch 'hotfix/2.0.1' set up to track remote branch 'hotfix/2.0.1' from 'origin'.
Already on 'hotfix/2.0.1'
Your branch is up to date with 'origin/hotfix/2.0.1'.

Summary of actions:
- The remote branch 'hotfix/2.0.1' was created or updated
- The local branch 'hotfix/2.0.1' was configured to track the remote branch
- You are now on branch 'hotfix/2.0.1'
root@LE11-D7891:~/github/devsecops-laboratory# git checkout master; git push
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Everything up-to-date
root@LE11-D7891:~/github/devsecops-laboratory# git checkout master; git push
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Everything up-to-date

root@LE11-D7891:~/github/devsecops-laboratory# git checkout hotfix/2.0.1 && git pull
Switched to branch 'hotfix/2.0.1'
Your branch is up to date with 'origin/hotfix/2.0.1'.
Already up to date.
root@LE11-D7891:~/github/devsecops-laboratory# git flow hotfix finish -Fp 2.0.1

Everything up-to-date
Everything up-to-date
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100% (1/1), 184 bytes | 184.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To https://github.com/mrnim94/devsecops-laboratory.git
 * [new tag]         v2.0.1 -> v2.0.1
To https://github.com/mrnim94/devsecops-laboratory.git
 - [deleted]         hotfix/2.0.1
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
Deleted branch hotfix/2.0.1 (was 89fe713).

Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch 'hotfix/2.0.1' has been merged into 'master'
- The hotfix was tagged 'v2.0.1'
- Hotfix branch 'hotfix/2.0.1' has been locally deleted; it has been remotely deleted from 'origin'
- 'develop', 'master' and tags have been pushed to 'origin'
- You are now on branch 'develop'
Coding

Post navigation

Previous Post: [Git] How to change your username and email for authentication with the code pushed to Git.
Next Post: [sweetalert2] Utilize SweetAlert2 to add an additional popup to your website.

More Related Articles

[GRPC] Checking GPRC Port by fullstorydev/grpcurl Coding
[Selenium] Undetected Selenium Webdriver – Làm sao trang web không nhận ra bạn đang sử dụng Selenium Webdriver! Coding
Conventional Commits Coding
[Telegram] Hướng dẫn tạo 1 con bot nhắn tin trong telegram Coding
[Github] Prevent contributors from pushing code to the master branch and creating tags. Coding
[Code] Beautiful code offline – On PC – On Laptop Coding

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Azure] The subscription is not registered to use namespace ‘Microsoft.ContainerService’ May 8, 2025
  • [Azure] Insufficient regional vcpu quota left May 8, 2025
  • [WordPress] How to add a Dynamic watermark on WordPress. May 6, 2025
  • [vnet/Azure] VNet provisioning via Terraform. April 28, 2025
  • [tracetcp] How to perform a tracert command using a specific port. April 3, 2025

Archives

  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
    • NextCloud
  • CI/CD
    • Argo Events
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • DevSecOps
    • Golang
    • Jquery & JavaScript
    • Laravel
    • NextJS 14 & ReactJS & Type Script
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • Azure Cloud
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
      • Pod
    • Longhorn – Storage
    • MetalLB
    • OAuth2 Proxy
    • Vault
    • VictoriaMetrics
  • Log, Monitor & Tracing
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Fluent
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2025 NimTechnology.