DevOps Classroom Series (Evg) – 18/Dec/2021

Git Tags

  • Tagging in git lest developers mark important checkpoints in the course of project development.
  • Generally when we make a release we will create a tag and push it to the server
  • Git Tags are of two types
    • Lightweight tag git tag v1.1
    • Annotated Tag git tag -a v1.1 -m "my release 1.1
  • They differ in the way are store.
  • Annotated tags are stored as full objects in Git database. They store the tagger name, email, date.
  • Lightweight tags are have just the tag Preview

Branching Strategy

  • Refer Here to understand the git flow branching strategy

Git Pull Requests

  • Refer Here for GitHub pull requests
  • Refer Here for pull requests in Azure DevOps
  • Please watch the recording for understanding steps to create pull requests.

Git Stash

  • Fifth area of Git
  • Git stash can temporarily stash (or shelve) the changes you have made in the working copy, so that you can work on something else and then come-back and re-apply your work
  • Lets assume you have made some changes in repo and you are asked to work on a new feature Preview
  • So you stash your changes as shown above
  • Now you work on new feature and finish the changes Preview
  • Now you want your earlier stashed code back
    • apply: Apply will bring your changes back to the working tree and stash will still remember your stashed items Preview
    • pop: This will bring back your changes to the working tree and remove the changes from the stash list Preview
  • You can have multiple stashes Preview Preview

Git Hooks

  • Git Hooks are a simple concept which was implemented to address the need of executing some commands as a reaction to git events.
  • Hooks are classified into two types
    • Client Side Hooks: They are basically executed on developers computer
    • Server Side Hooks: These hooks are execute on the server that are used to recieve pushes
      • Pre-recieve and post-recieve
      • Update
  • Git stores its hooks in .git/hooks folder
  • Lets try to understand some hooks Preview
  • To execute any hook, we need to ensure we have a file with executable permission with the hook’s name
  • Refer Here for some of the git hooks
  • WebHooks are alternative to Server side hooks, which allow you to call a REST API

Git Submodule

  • Submodules allow you to add one git repository into another
  • Lets take a simple repo Preview
  • Now lets add a spring-petclinic project into folder java/11/spring-petclinic
git submodule add https://github.com/spring-projects/spring-petclinic.git java/11/spring-petclinic

Preview

  • Now lets see the status of parent repo and submit the changes to git repo Preview Preview
  • To clone a rep with submodules
git clone --recursive <git url>

or 
clone 
git submodule update

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin