DEV Community

Yongchang He
Yongchang He

Posted on

Multiple developers work simultaneously using their own branch on git

1. Create a new branch:

git checkout -b yong-active-members-dev
Enter fullscreen mode Exit fullscreen mode

Switched to a new branch 'yong-active-members-dev'
yongchanghe@MacBookPro 868_class_project_civitas_practice_repo % git push origin yong-active-members-dev
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: Create a pull request for 'yong-active-members-dev' on GitHub by visiting:
remote: https://github.com/hyc0812/868_class_project_civitas_practice_repo/pull/new/yong-active-members-dev
remote:
To https://github.com/hyc0812/868_class_project_civitas_practice_repo.git

  • [new branch] yong-active-members-dev -> yong-active-members-dev

2. Check Which branch is currently used:

git branch -a
Enter fullscreen mode Exit fullscreen mode

master

  • yong-active-members-dev remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/yong-active-members-dev

3. Develop the new branch and commit the changes

4. When complete, go back to master branch

git checkout master 
Enter fullscreen mode Exit fullscreen mode

Switched to branch 'master'
Your branch is up to date with 'origin/master'.
yongchanghe@MacBookPro 868_class_project_civitas_practice_repo % git pull origin master
From https://github.com/hyc0812/868_class_project_civitas_practice_repo

  • branch master -> FETCH_HEAD Already up to date.

5. Merge your branch to master

git merge yong-active-members-dev
Enter fullscreen mode Exit fullscreen mode

Updating 98f2681..4fdc41c
Fast-forward
src/app/demo/dashboard/active-members/active-members.component.html | 1 +
1 file changed, 1 insertion(+)

6. Push to master branch

git push origin master 
Enter fullscreen mode Exit fullscreen mode

Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/hyc0812/868_class_project_civitas_practice_repo.git
98f2681..4fdc41c master -> master
yongchanghe@MacBookPro 868_class_project_civitas_practice_repo %

Top comments (0)