github - what does this git code that I use for merging my branch with master branch actually do? -


i'm new , understand of how i'm using it, when want merge master , add changes don't what's going on.

this flow:

first edits , commit them my-branch. do

git checkout master git pull origin master git checkout my-branch git merge master 

so think in first line

git checkout master 

i'm switching master branch. i'm not entirely sure means. think means if commit @ point change master directly. know files stay in same shape , maintain of edits.

then, have no idea second line

git pull origin master 

in third line

git checkout my-branch 

i'm switching my-branch (again, not entirely sure of implications).

then, finally, merge two.

git merge master 

i have no idea unmerged files are, when initiate pull request on git website see nice diff.

i'm bit confused why i'm initiating on website "pull request" because seems more commit.

git checkout master 

this switches master branch. changes committed in my-branch, not in master removed, , changes committed in master not in my-branch applied repository. yes, if started changing , committing files now, altering master.

note changes you've made while in my-branch have not yet committed stick around. can cause conflict if commits in branch you're switching make changes same places. if there conflict, git won't let switch branches until either commit changes, or stash them.

git pull origin master 

this 2 things:

  1. it fetches changes origin, i.e. downloads them local branch set track remote branch. local remote-tracking branch isn't interact with, it's handled automatically git. in fact, won't shown git branch --list.
  2. it merges changes master. sometimes, may have perform manual merging if git cannot figure out how safely itself.

note doesn't initiate "pull request". it's called pull because it's pulling remote changes local repository. pull request asking else pull you.

git checkout my-branch 

this same previous checkout, in opposite direction.

git merge master 

this merges changes master has, my-branch not, my-branch. thus, my-branch has master has, master does not have new changes my-branch.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -