Git Tags
- Git has a concept called as tagging using
git tagcommand. - Tags are ref’s that points to specific commit (points) in Git History
- A tag is like a branch that doesn’t change
- To create a tag
git tag <tagname> - Git supports two types of tags
- Annotated Tag:
- This storage extra metadata such as tagger name, email and date.
- command
git tag -a <TagName> -m "<Tag Message>"
- Lightweight Tag:
- This is like a bookmark to a commit
- command:
git tag <TagName>
- Annotated Tag:
- ReTagging:
- Best Practice is to use Annotated tags as public tag and lightweight tags for private
- Tags is a standard practice to mark some thing important in Git History like
- Given release to internal QA team
- All the bugs fixed on a particular commit
- Given release to external Team etc
Git Submodules
- Lets assume you have different git repos for different apis build by your team
- Lets clone a repo and add other repositories as submodules
- After pushing the changes and view them on github
- Now lets work with submodules and make changes
- Clone the following git repo
https://github.com/GitPracticeRepo/qtecommerceapr.git
git clone --recursive https://github.com/GitPracticeRepo/qtecommerceapr.git
or
git clone https://github.com/GitPracticeRepo/qtecommerceapr.git
cd qtecomerceapr
git submodule update --init
- To pull all the repository changes including submodules
Git Alias
- Git alias is a shortcut to some git command
- If i want a shortcut to status command as st
git config --global alias.st status
- Alias are stored in
<HOME-DIR>/.gitconfig - Create any two aliases and verify the config file and command usage
Branching Strategies
- We will discuss two branching strategies
- Git Flow
- GitHub Flow
- GitLab Flow
Git Flow
- Refer Here for the documentation
GitHub Flow
GitLab Flow
Pull Request
- A Pull request is also referred as merge request.
- This happens when developer is ready to begin the process of merging the code changes to a branch or repository
- As a Developer, We review the code on pull request.
- As a DevOps Engineer, When Developer submits a pull request we run ci and quality gate & only if it works we allow the merge to happen
- Lets see pull request in action. Refer Here
- We can integrate pull request in
- Azure DevOps Refer Here
- Jenkins Refer Here
Git Hooks
- Git Hooks are the scripts that Git Executes before or after events such as commit, push and recieve
- There are two groups of hooks
- Client Side Hooks/local hooks:
- These execute on local repo
- Server Side Hooks/Remote Hooks:
- These execute on remote repo
- Client Side Hooks/local hooks:
- Refer Here for the atlassian docs
- Refer Here for the repository with useful hooks
- Cloud providers give a workaround to run the server side hooks which are referred as webhooks
