DevOps Classroom Series – 08/Feb/2021

Multiple Users Workflow

Scenario:

  • Your Organization has a remote repository configured on GitHub
  • Two developers are working on features and they push the changes to git Hub Preview Preview
  • Now developers are working for release 1.0
    • Lets create a branch called as rel_1.0 and push the branch to github Preview Preview Preview
  • Now developer 1 is working on linux machine machine
    • He is working on to create basic folder structure and he commits the changes Preview
    • Now configure username and email and commit the changes to local repo
    • Now lets push the changes to remote repository Preview
  • Developer 2 who is working on windows machine needs to get the changes submitted to start working
  • Now Developer 1 will be working on feature 1 and Developer 2 will be working on feature 2
    • To do this, lets assume organization is following feature branch approach
    • Feature branch approach is where developers create a branch locally for every feature and once the finish developing the changes, they will merge the changes to the rel_1.0 branch and push the changes Preview Preview
  • Now developer1 has merged the changes of feature1 to rel_1.0 branch and pushed the changes to the repository Preview
  • Now developer 2 wants to merge the change of feature 2 to rel_1.0 branch.
  • To ignore some files or folders we create a file called .gitignore in the root folder and specify which folders or files need to be excluded from git
  • Refer Here
  • To generate git ignore file for the tools which you use Refer Here

Git configuration

  • This is config command to set some configuration values
  • In Git we have different config levels and files
    • –local: This is present in the .git/config
    • –global: This applies to a particular os user ~/.gitconfig
    • –system: This a system level configuration applied to all the users on the machine $(installpath)/etc/gitconfig
  • Refer Here for configuration values from official docs and Refer Here for attlasian documentation
  • Git Alias Preview

Git Tags

  • Tag refers to the specific commit in git history
  • Git supports two kinds of tags
    • Lightweight tags
    • Annotated Tags
  • Annotated tags differ in amount of metadata they store Preview Preview
  • Refer Here for the official docs and Refer Here for attlasian tutorial

Changing the previous commits

  • Lets assume you have 3 commits f1,f2,f3 Preview
  • Now if you want to delete the f2 commit
git rebase -i HEAD~3
# fix merge conflicts if any and continue rebase

Preview Preview

  • Now lets try to combine f1 and f3 as one commit
git rebase -i HEAD~2

Preview Preview Preview

Cloning a Particular Branch on Git repo

  • Clone only gh-pages branch from spring petclinic Refer Here Preview

Git bare repositories

  • Generally when we clone repositories we get the working tree and .git folder.
  • But on git remote repositories (i.e. git on servers) we might not need working tree as no one will be working there, there we can clone bare repositories
  • In bare repositories you get only .git folder Preview

Next Steps

  • We will learn the git communication protocols
  • GitHub/BitBucket/Git Pull request
  • Git branching strategy
  • We will learn how to build the code and start using jenkins and then visit the leftover git topics

Leave a Reply

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

About learningthoughtsadmin