0
0
Gitdevops~10 mins

Why Git integrates with CI/CD - Visual Breakdown

Choose your learning style9 modes available
Process Flow - Why Git integrates with CI/CD
Developer writes code
Commit code to Git repository
Git triggers CI/CD pipeline
CI/CD runs tests and builds
If tests pass, deploy code
Code live in production
This flow shows how committing code to Git starts the CI/CD process automatically, leading to testing and deployment.
Execution Sample
Git
git commit -m "Add feature"
git push origin main
Developer commits code and pushes to Git, triggering the CI/CD pipeline.
Process Table
StepActionGit StateCI/CD TriggeredPipeline StatusResult
1Developer writes codeLocal changesNoN/ACode ready to commit
2git commit -m "Add feature"Committed locallyNoN/ACode saved in local repo
3git push origin mainCode pushed to remoteYesStartedCI/CD pipeline triggered
4CI/CD runs testsRemote repo unchangedYesRunning testsTests executing
5Tests passRemote repo unchangedYesSuccessReady to deploy
6Deploy codeRemote repo unchangedYesDeployedCode live in production
7Pipeline endsRemote repo unchangedNoCompleteProcess finished
💡 Pipeline ends after deployment or test failure
Status Tracker
VariableStartAfter Step 2After Step 3After Step 5Final
Git StateNo changesCommitted locallyCode pushed to remoteCode pushed to remoteCode pushed to remote
CI/CD TriggeredNoNoYesYesNo
Pipeline StatusN/AN/AStartedSuccessComplete
Key Moments - 2 Insights
Why does pushing code to Git trigger the CI/CD pipeline?
Because the remote Git repository is connected to the CI/CD system, so when new code arrives, it automatically starts the pipeline as shown in step 3 of the execution table.
What happens if tests fail during the CI/CD process?
The pipeline stops before deployment, so the code is not deployed. This is implied in the exit note and the pipeline status would show failure instead of success.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does the CI/CD pipeline start?
AStep 2
BStep 3
CStep 4
DStep 5
💡 Hint
Check the 'CI/CD Triggered' column in the execution table; it changes to 'Yes' at step 3.
According to the variable tracker, what is the 'Pipeline Status' after tests pass?
ASuccess
BStarted
CRunning tests
DComplete
💡 Hint
Look at the 'Pipeline Status' row in variable tracker after step 5.
If the developer only commits locally but does not push, what happens to the CI/CD pipeline?
AIt starts immediately
BIt runs tests locally
CIt waits until push
DIt deploys code automatically
💡 Hint
Refer to steps 2 and 3 in the execution table where CI/CD triggers only after push.
Concept Snapshot
Git integrates with CI/CD by triggering pipelines when code is pushed to the remote repository.
Commit saves code locally; push sends it to remote.
CI/CD runs tests and deploys if tests pass.
This automation ensures code quality and faster delivery.
Full Transcript
When a developer writes code, they first commit it locally using Git. This saves the changes on their computer but does not affect the shared project yet. When they push the code to the remote Git repository, this action triggers the CI/CD pipeline automatically. The pipeline runs tests to check the code quality. If tests pass, the pipeline deploys the code to production. If tests fail, deployment stops to prevent errors. This integration helps teams deliver code safely and quickly by automating testing and deployment steps.