Giter Site home page Giter Site logo

fun-exercise-git's Introduction

Fun Exercise: Git Collaboration and Feature Toggle Challenge

Table of Contents

Prerequisites

Instructions

Step 1: Fork the repository

Step 2: Clone the forked repository to your local machine

  • Clone the forked repository to your local machine
git clone <your-forked-repository-url>

Challenge 1: Three-Way Merge Practice by using git commit and git merge

Guide:

  • Create a new branch from the main branch e.g. maithai-feature
  • Checkout to the new branch
  • Edit the CONTRIBUTORS.md file by adding your name to the Contributors section
  • Commit the changes
  • Checkout to the main branch
  • Merge the new branch to the main branch
  • Push the changes to the remote repository at main branch verify by using git log --graph --oneline. You should see the commit history like below:
* commit C (main): Merge branch 'maithai-feature'
|\
| * commit B (maithai-feature): Implement feature Maithai
|/
* commit A: Initial project setup
Hint Challenge 1 (try it your self first before open this hint)
  • Create a new branch from the main branch e.g. maithai-feature
git branch maithai-feature
  • Checkout to the new branch
git checkout maithai-feature
  • Edit the CONTRIBUTORS.md file by adding your name to the Contributors section
  • Commit the changes
git add CONTRIBUTORS.md
git commit -m "Add my name to the Contributors section"
  • Checkout to the main branch
git checkout main
  • Merge the new branch to the main branch
git merge maithai-feature --no-ff
  • Push the changes to the remote repository at main branch
git push origin main

Challenge 2: Three-Way Merge Practice by using Pull Request

Guide:

  • Create a new branch from the main branch e.g. monkan-feature
  • Checkout to the new branch
  • Edit the CONTRIBUTORS.md file by adding your name to the Contributors section
  • Commit the changes
  • Push the changes to the remote repository at the new branch
  • Create a Pull Request from the new branch to the main branch
  • Merge the Pull Request
  • Pull the changes from the remote repository at the main branch
  • Verify by using git log --graph --oneline. You should see the commit history like below:
* commit E (HEAD -> main, origin/main): Merge pull request #1 from <your-github-username>/monkan-feature
|\
| * commit C (monkan-feature): Implement feature Monkan
|/
* commit C (main): Merge branch 'maithai-feature'
|\
| * commit B (maithai-feature): Implement feature Maithai
|/
* commit A: Initial project setup
Hint Challenge 2 (try it your self first before open this hint)
  • Create a new branch from the main branch e.g. monkan-feature
git branch monkan-feature
  • Checkout to the new branch
git checkout monkan-feature
  • Edit the CONTRIBUTORS.md file by adding your name to the Contributors section
  • Commit the changes
git add CONTRIBUTORS.md
git commit -m "Add my name to the Contributors section"
  • Push the changes to the remote repository at the new branch
git push origin monkan-feature
  • Create a Pull Request from the new branch to the main branch
  • Merge the Pull Request
  • Pull the changes from the remote repository at the main branch
git pull origin main

Challenge 3: Feature Toggle

Guide:

  • Checkout to the main branch
  • Go to challenge3 directory cd challenge3 directory
  • make run or javac Main.java then java Main to verify the result. You should see Sending via SMS.
Email notification feature toggle is DISABLED
Sending SMS to 0812345678: Hello, Java!
  • Enable the Email feature by changing the featureToggle.setEmailNotificationEnabled to true
  • Verify the result make sure the email notification is sent to the email address that you specified by using make run then see the result.
  • Commit the changes on the main branch
  • Push the changes to the remote repository at the main branch verify by using make run. You should see the email notification is sent to the email address that you specified
Email notification feature toggle is ENABLED
Sending email to [email protected]: Hello, Java!
Hint Challenge 3 (try it your self first before open this hint)
  • Checkout to the main branch
git checkout main
  • Go to challenge3 directory cd challenge3 directory
  • Enable the feature by changing the featureToggle.setEmailNotificationEnabled to true
  • Verify the result make sure the email notification is sent to the email address that you specified
make run
  • Commit the changes on the main branch
git add Main.java
git commit -m "Enable email notification feature toggle"
  • Push the changes to the remote repository at the main branch
git push origin main

Challenge 4: Tag version

Guide:

  • Checkout to the main branch
  • Create a new tag e.g. v1.0.0
  • Push the tag to the remote repository
  • Verify by using git tag. You should see the tag that you created or look at the GitHub repository tag section
v1.0.0
Hint Challenge 4 (try it your self first before open this hint)
  • Checkout to the main branch
git checkout main
  • Create a new tag e.g. v1.0.0
git tag -a v1.0.0 -m "Release version 1.0.0 : send email notification"
  • Push the tag to the remote repository
git push origin --tags

fun-exercise-git's People

Contributors

anuchito avatar gamecodez avatar werockstar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.