DevOps Classroomnotes 23/Feb/2023

Git Contd

Git Rebase

  • Refer Here for docs
  • Git rebase is a command used to get changes from one branch onto another by rewriting history
  • Consider the following situation where main has two commits after the sprint 0 branch was created
    Preview
    Preview
  • Now we want the changes done in main branch to be part of sprint0 branch
  • If we merge the changes from main into sprint 0
    Preview
  • If we rebase
    Preview
  • Rebase is useful for all the child branches but never rebase main/master from child as rebase rewrites history.
  • To rebase checkout to sprint0 and rebase from main git rebase main
    Preview
    Preview
    Preview
    Preview

Git cherry pick

  • Refer Here for docs
  • If we need to pick specific commits or specific range of commits (sequence) of commits , cherry pick can be used
  • Now consider the following
    Preview
  • we need the changes form commit id f3ae24b in main branch
  • lets cherry pick
    Preview

Remote Repository

  • Git Remote Repository is any folder on any server
  • To make Git Remote accessible, generally two protocols are widely used
    • http(s)
    • ssh
  • There are many popular Git Repositories which are available for free.
  • Today lets get started with GitHub
  • Create a new repository in GitHub
    Preview
    Preview
    Preview
  • Now add this repository as remote to your local repository
    Preview
  • Now lets push the changes from local to remote git push <remote-name> <branch/tag name>
    Preview
    Preview
  • Now lets see all the branches in the repo
    Preview
  • The branches in remote represent remote branches
  • Now lets push the sprint 0 branch as well
    Preview
  • In Organizations we will already have some repositories, Now to get the changes from remote to local we perform clone. Lets clone spring pet clinic
    Preview
    Preview
  • Summary
    Preview

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube