Introduction
Recently, I came across some topics that helped me deepen my understanding of Git—especially in the context of CI/CD pipelines.
Running Git Commands in Pipeline Scripts
Git commands can be used within pipeline scripts that run on agents. For example, you might need to pull files from external Bitbucket repositories as part of your build workflow.
🔗 Using Git Commands in Azure Pipelines
What Does the checkout Step Do?
Here’s a typical Git workflow in an Azure pipeline:
|
|
To optimize configuration and metadata:
|
|
Then, the pipeline checks out a specific commit (or branch):
|
|
This checkout is done on a temporary branch that exists only during the pipeline execution.
Are There Any Constraints?
Yes, there are some permission-related constraints. Pipelines can access all repositories in your project or organization if you configure two specific settings.
🔗 Pipeline Access Tokens and Scope
What Did I Learn from This?
I didn’t learn everything, but this definitely sparked more curiosity around optimizing repository cloning.
For example, shallow cloning is a great way to reduce clone time, bandwidth usage, and overall pipeline overhead:
|
|
or directly:
|
|
This fetches only the latest commit instead of the full history—a small tweak that can make a big difference.
Conclusion
I’m excited to keep learning more about how things work behind the scenes. It’s always rewarding to discover these small “aha!” moments during daily work.
Offtopic
