DevOps Classroom series – 02/May/2020

Background:

Preview

  • For all of the demonstrations in this series, consider you have two developers and one remote repo hosted in github

Scenarios for Merge-Conflict

  1. Developer A is Creating the basic structure of project. This project uses python django and angularjs. so the basic folder will be the first commit Refer Here

  2. Devloper B gets the latest version

  3. Both Developer A and Developer B are working on Same files and they decide to update the remote repository Preview Preview

  4. Developer B pushes the code to Remote Repository Preview

  5. Devloper A push will fail, he needs to get the latest version and when he tries to pull he gets merge conflict Preview Preview

  6. Fix the code to be right Preview

  7. Add the changes and execute git commit now developer A can push changes Preview Preview

Scenario: Mutliple Branches

  • QT decided to work on two version parallelly along with main development branch master
    • release-a (apollo hospitals)
    • release-b (continental hospitals)
  • To do this we use branches in git
  • Our branches will be as shown below Preview
  • To create a branch
git branch <branch-name>
  • To Create the branch and move the head to new branch
git checkout -b branch
  • To view all the branches
git branch
  • To push the branches to the remote repository
git push <remote> <branch>

Preview Preview Preview

  • Now if the developer B pulls the code he gets all the commits and also branches Preview Preview

Git – Merge

  • Normal Merge Preview Preview

  • Fast-Forward Merge: Preview

    • Now you want to merge the changes from release-C to master and master has not changed at all, creating a new commit will not be required and git just moves the master branches pointer to the latest commit ID on release -C Preview Preview
    • note: If you dont want fastforward do merge with git merge --no-ff <branch>

Git – Rebase

  • Images Preview Preview Preview Preview

  • Commands Preview Preview

  • Interactive Rebase is also used to change the history of local commits

Git-Cherry Pick

Preview Preview Preview Preview

Git Topics To be Covered Post Jenkins

  • Git Protocols
  • Git Hooks
  • Branching Strategies
  • Forking in Git Repositories
  • Git Bare repositories
  • making changes in history using interactive rebase
  • Git Stash

Leave a Reply

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

About learningthoughtsadmin