Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Git Work Flow

BRANCH WORK FLOW


Contents

Branch Pattern............................................................................................................. 3
GIT INITIAL WORKFLOW PROCESS ................................................................................ 4
GIT REPEATITIVE WORKFLOW PROCESS ....................................................................... 6

2
SOLID INDIA CAPABILITY DOCUMENT
Branch Pattern
Main Branches 3:
 Master Branch (For Development Environment)
 Staging Branch (For Testing Environment)
 Production Branch (For Production Environment)

Development Sub Branches:


 For new feature :
a. feature/<feature_name>

 For bug fixes:


a. bugfix/ <bug_fix_name>

 For change in existing feature:


a. change/ <change_name>

 For production priority bug fixes:


a. hotfix / <hot_fix_name>

3
SOLID INDIA CAPABILITY DOCUMENT
GIT INITIAL WORKFLOW PROCESS
1. Install Laravel

2. Initialise git in project directory


$ git init

3. Add all files to staging area


$ git add .

4. Commit the changes


$ git commit -m "Installed Laravel"

5. For New feature checkout to new branch.


$ git checkout -b <FEATURE_NAME>

NOTE: Always Start Work In New Branch And Never In Master . If two people are working on the
same feature the branch name should be same.

6. Make changes and once all the changes are done add all files to staging and commit
 if we have made changes in front end then build files in production Environment before
commiting
$ npm run prod

$ git add .
$ git commit (Enter detailed message)

7. If there are some more changes follow step 6

8. Checkout to Master Branch


$ git checkout master

9. Create new remote repo on github or bitbucket

10. Copy the https url of the remote repo and add remote origin to the local repo
$ git remote add origin YOUR_LINK_TO_REMOTE_REPO

11. Checkout to the feature branch which we want to push to the remote repo
$ git checkout <FEATURE_NAME>

12. If remote feature branch is updated then first pull those changes into your local feature branch.
$ git pull origin <BRANCH_NAME>

13. Push this branch to the remote repo with upstreaming


$ git push origin -u <FEATURE_NAME> (-u only for the first time)

4
SOLID INDIA CAPABILITY DOCUMENT
14. In bitbucket create a pull request for this branch

15. if there are no conflicts and no errors then pull request will be approved
 feature branch will be merged with Master
$ git checkout master
$ git pull
$ git pull --no-ff origin <FEATURE_NAME>
$ git push -u origin master (-u only for the first time)

16. Else Pull request will be declined


 Make require changes and commit and push it to remote branch follow step 14 and 15
 Automatically commit will reflect in pull request no need to create pull request

17. Delete sub Branches once it is merged into master


 To delete remote branch
$ git push origin :<branch_name> (REMOTE BRANCH)

 To delete local branch


$ git branch -d <BRANCH_NAME>

 After deleting sub Branches run


$ git fetch --all --prune (To delete tracking of remote branch from local)

5
SOLID INDIA CAPABILITY DOCUMENT
GIT REPEATITIVE WORKFLOW PROCESS
1. If two people are working on the same feature the branch name should be same.
 For New feature checkout to new branch
$ git checkout -b <FEATURE_NAME>

NOTE: ALWAYS START WORK IN NEW BRANCH AND NEVER IN MASTER

2. Make changes and once all the changes are done add all files to staging and commit
 if we have made changes in front end then build files in production Environment before
commiting
$ npm run prod

$ git add .

$ git commit (Enter detailed message)

 if we haven't pushed the changes to remote repo and we want to reduce number of commits
then we can use git amend . Amend will overwrite previous commit id with new id and will
add current changes into previous commit. Then you can edit previous commit message
$ git commit --amend

3. If there are some more changes follow step 2

4. Once you are ready to push changes to remote


 Checkout to Master Branch
$ git checkout master

 Pull the changes from remote to update local repo


$ git pull

5. Checkout to the feature branch which we want to push to the remote repo
$ git checkout <FEATURE_NAME>

6. If remote feature branch is updated then first pull those changes into your local feature branch.
$ git pull origin <BRANCH_NAME>

7. Push this branch to the remote repo with upstreaming


$ git push

8. In bitbucket create a pull request for this branch

6
SOLID INDIA CAPABILITY DOCUMENT
9. if there are no conflicts and no errors then pull request will be approved

 feature branch will be merged with Master


$ git checkout master
$ git pull
$ git pull --no-ff origin <FEATURE_NAME>
$ git push -u origin master (-u only for the first time)

10. Else Pull request will be declined

 Make require changes and commit and push it to remote branch follow step 14 and 15
 Automatically commit will reflect in pull request no need to create pull request

11. Delete sub Branches once it is merged into master

 To delete remote branch


$ git push origin :<branch_name> (REMOTE BRANCH)

 To delete local branch


$ git branch -d <BRANCH_NAME>

 After deleting sub Branches run


$ git fetch --all --prune (To delete tracking of remote branch from local)

7
SOLID INDIA CAPABILITY DOCUMENT

You might also like