DevOps Classroomnotes 15/Sep/2022

Cherry-Pick

  • Consider the following DAG, we need changes in the blue commit on the POC_1 branch
    Preview
  • If we need specific commits or sequence of commits from other branches
    Preview
  • Get the commit id of commit 6 (blue commit) 5ed34d0
  • now checkout to target branch git checkout <target branch> and To cherry-pick use git cherry-pick <commit-id>
    Preview
  • If we get any merge conflicts, resolve add and continue cherry pick like rebase.
  • Exercise: Find how to cherry pick range of commits

Bring Remote into Action

  • For this demonstration

    • User 1:
      • all the images from powershell will be user 1
      • config: username: qtdevops
      • c:\temp\user1
    • User 2: all the images from git bash will be user 2
      • config: username: qtcloud
      • c:\temp\user2
  • Lets create a new git repository with some content
  • We already have remote repository, user1 and user2 want to work, so they need local repos.
  • Creating a local repo when we already have a remote is clone
    Preview
  • we will have local and remote branches on local repo
    Preview
    Preview
  • Now User 1 makes a change, commits to local rep
    Preview
  • Now user 1 wants to push the changes to remote repository
    • origin/main and remote repository main commit id should match
    • Since they are matching push git push <remote name> <branch name>
      Preview
      Preview
  • Now User 2 wants to push a change (he is unaware of change done by user 1)
  • User 2 does the local commit
  • The below image represents the current situation
    Preview
  • When User 2 pushes he gets the following error message
    Preview
  • So pull the changes (pull => Fetch + merge)
    Preview
    Preview
  • Here we get an extra merge commit
  • Alternative to make commit history clean we can use git pull --rebase
    Preview
  • Now lets push the changes
    Preview
    Preview
    Preview
  • Refer Here for commits on github

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