Skip to content

Git Development Process

Typical development workflow

First time create local workspace

Command Line

  1. Run git clone mainline-url.

    git clone <origin-url>
    
  2. Run git config to set author name and email for this repo.

    git config user.name "<your-cec>"
    git config user.email <your-email>
    
  3. Create a fork (bottom left corner for BitBucket, up right corner for GitHub).

  4. Set a remote to point at your fork.

    git remote add <your-cec> <your-fork-url>
    
  5. Check if set successfully.

    git remote -v # if you see two remote upstreams (one is origin, the other is your cec), you are success
    

💡 Recommend to set base repository as origin, your own fork as cec.

Source Tree

  1. Clone remote repository

    • Clone from URL source tree clone from URL
    • Clone a repository source tree clone repository
    • Double click newly cloned repository newly cloned repository
  2. Set author name and email for this repo. author name and email

  3. Create a fork (bottom left corner for BitBucket, up right corner for GitHub).

  4. Add a remote to point at your fork.

    • Go to Settings -> Remotes source tree remotes
    • Add your fork as remote source tree add remote
  5. Check if set successfully. source tree check add remote successfully

Short-lived individal feature development

This is the most common case.

Command Line

  1. Create feature branch on your own fork based on origin master.

    git checkout -b <feature-branch> origin/master # create a new branch based on origin master
    git pull # keep code updated with remote
    git push -u <your-fork> <feature-branch> # push the branch to your own fork
    
  2. Add your feature code and unit tests. Make sure everything runs fine before you continue your merge process.

  3. Commit your changes.

    git add . # or add any needed files
    git commit -m "<commit messages>"
    
  4. Update code from origin master (fix conflict if needed).

    git pull origin master --rebase # update your code on rebase mode
    
  5. Push your code to remote tracking branch.

    git push <your-fork> <feature-branch> # push local commits to your remote fork
    
  6. Go to GitHub or BitBucket to rise a Pull Request to master.

  7. During review processing, Iterate step 3 to step 5 until your PR enables the merge button, then merge.

  8. (Recommend to delete the feautre branch to keep workspace clean)

  9. (Integration test based on master)

Source Tree

  1. Create feature branch on your own fork based on origin master.
    • Pull from origin/master to update latest code source tree pull
    • Create new branch based on local master (branch that tracking origin/master) source tree create branch
  2. Add your feature code and unit tests. Make sure everything runs fine before you continue your merge process.
  3. Commit your changes. source tree commit
  4. Update code from origin master (fix conflict if needed). source tree pull update code
  5. Push your branch and code to your remote own fork. source tree push changes
  6. Go to GitHub or BitBucket to rise a Pull Request to master.
  7. During review processing, Iterate step 3 to step 5 until your PR enables the merge button, then merge.
  8. (Recommend to delete the feautre branch to keep workspace clean)
  9. (Integration test based on master)

Short-lived shared feature branch development

This case applies to collaborative development, and the feature can be finished within current sprint (can be merged to master shortly).

💡 This case is just the same as the branch based development model.

Command Line

  1. Create feature branch on origin based on master.

    git checkout -b <feature-branch> origin/master # create a new branch based on origin master
    git pull # keep code updated with remote
    git push -u origin <feature-branch> # push the branch to origin
    
  2. Add your feature code and unit tests. Make sure everything runs fine before you continue your merge process.

  3. Commit your changes.

    git add . # or add any needed files
    git commit -m "<commit messages>"
    
  4. Update code from origin master (fix conflict if needed).

    git pull # update code from remote tracking branch incase there is any updates made by your peer.
    git pull origin master --rebase # update your code on rebase mode
    
  5. Push your code to remote tracking branch.

    git push origin <feature-branch> # push local commits to remote
    
  6. Go to GitHub or BitBucket to rise a Pull Request to master.

  7. During review processing, Iterate step 3 to step 5 until your PR enables the merge button, then merge.

  8. (Recommend to delete the feautre branch to keep workspace clean)

  9. (Integration test based on master)

Source Tree

  1. Create feature branch on your own fork based on origin master.

    • Pull from origin/master to update latest code source tree pull
    • Create new branch based on local master (branch that tracking origin/master) source tree create branch
  2. Add your feature code and unit tests. Make sure everything runs fine before you continue your merge process.

  3. Commit your changes. source tree commit

  4. Update code from feature branch (if there is parallel update) and origin master (fix conflict if needed).

    source tree pull update code

    source tree pull update code

  5. Push your code (and branch) to remote origin.

    source tree push changes

  6. Go to GitHub or BitBucket to rise a Pull Request to master.

  7. During review processing, Iterate step 3 to step 5 until your PR enables the merge button, then merge.

  8. (Recommend to delete the feautre branch to keep workspace clean)

  9. (Integration test based on master)

Long-lived shared feature branch development

This is a extended case for above collaborative development, the feature cannot be finished within current sprint, in other words, feature branch can not be merged to master shortly, which may lead to problem for integration test.

💡 Normally this pattern should be strictly forbidden, especially after we enabled CICD pipeline some day.

Release flow

Developing a feature

feature flow

Dealing with an EP

EP flow

Time Frame

time frame

Key Event

Event Deadline Action
Code Review Last last Friday before release day Review the code merge to develop/EP branch. Code review submitter should ensure code tested pass on local env, or pull request may be declined. DB SQL / Package ready
DB Review Last Monday before release day Review DB script(rollout owner)
Acceptance Test Last Monday before release day Accepter verify the feature on QA env, review MOP (team)
Code Freeze Last Tuesday morning at 9:00 before release day No more code will be merge to develop branch, action: 1. Check feature list (rollout owner)2. All code to master (rollout owner) 3. Release package ready, fork release branch and tag (rollout owner)
Verify BTS Last Wednesday before release day Refresh BTS env and verify
Verify Prod Release day, two days before last Wednesday of month Refresh production env and verify. After done, update pom.xml (each package version use release version, db script file version, create CMC version to new version)
Release Demo The next day after release day New features demo to customer

Reference

Git Best Practice

MCT CI/CD Workflow