follow this rule to use a repo github/bitbucket in order to avoid code pull/request conflict issue
Fork your own repository at https://bitbucket.xxx
# Click “Clone” button to get your own HTTP addresson the fork repository webpage
#Clone the repository to your local PC, onlydo once.
$git clone https://ooxx(replace with you own address)
#Setup a new branch named dev_master,only do once.
$git checkout master
$git pull origin master
$git checkout -b dev_master
# Working on dev_masterbranch
# Do these steps when you make code changes everytime
$git checkout master
$git pull origin master
$git checkout dev_master
$git merge master
$git add filename or git add .
$git commit -s -m “comment”
$git push origin dev_master:dev_master
#Pull request your change
Navigateto bitbucket webpage, Do pull request from your fork repository’s dev_master branch to team formal repository’s masterbranch
#if you pull request is rejected and will not be merged anymore, you shoulddiscard the dev_master branch
#Create a new branch such as dev_master2,only do once
$git checkout master
$git pull origin master
$git checkout -b dev_master2
# Working on dev_master2branch
# Same as above part, just replace dev_master with dev_master2
Command explain:
gitcheckout XXX : swith to XXX branch as your current branch
gitpull origin master: fetch from origin master branch and merge it to yourcurrent branch
gitcheckout -b XXX: create XXX branch and switch to it
gitmerge XXX: merge XXX branch to current branch
gitadd: add files to commit pool for next commit.
gitrm: remove files from commit pool for next commit.
gitmv: rename file or move location for next commit.
gitpush origin XXX:XXX : push and merge local XXX branch to remote XXX branch
https://blog.csdn.net/da_caoyuan/article/details/52649829