DevOps Classroomnotes 15/Sep/2022

Cherry-Pick

  • Consider the following DAG, we need changes in the blue commit on the POC_1 branch
  • If we need specific commits or sequence of commits from other branches
  • 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>
  • 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
  • we will have local and remote branches on local repo

  • Now User 1 makes a change, commits to local rep
  • 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>

  • 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
  • When User 2 pushes he gets the following error message
  • So pull the changes (pull => Fetch + merge)

  • Here we get an extra merge commit
  • Alternative to make commit history clean we can use git pull --rebase
  • Now lets push the changes


  • Refer Here for commits on github
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

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

Please turn AdBlock off
Customized Social Media Icons from Acurax Digital Marketing Agency

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Exit mobile version
%%footer%%