Why creating git branch doesn't copy all files? -
git branch
shows me i'm on master. write git checkout -b newbranch
. git branch
shows me i'm on newly created branch newbranch. write git pull
, following error:
there no tracking information current branch. please specify branch want merge with. see git-pull(1) details. git pull <remote> <branch> if wish set tracking information branch can with: git branch --set-upstream-to=origin/<branch> newbranch
i guess because couldn't pull branch created. write git pull origin master
, million files differ between branches master , newbranch (taking full console can't see beginning of error) following ending:
please move or remove them before can merge. aborting
i don't understand why branch newbranch isn't exact copy of master. read when create new branch starts same commit branch on. wanted make git pull
make sure files same on master. if new branch isn't exact copy of branch copied from, don't know files taken from.
edit: mentioned, problem local master different remote master. had do:
git checkout master git branch -d newbranch git fetch --all # change permision issues chmod , chown git reset --hard origin/master git checkout -b newbranch
one of important properties of git
git
distributed version control system. means local branch doesn't need in sync of remote branch.
in particular case, have master
on machine. when git checkout -b newbranch
, created new branch same master
on machine.
however there master
on remote machine name origin
(perhaps github if use it). when git pull origin master
, merging local newbranch
remote origin/master
instead of local master
. think case here local master
has merge conflicts origin/master
.
what should do
to create new branch
git checkout -b newbranch # create local newbranch local master git push --set-upstream origin newbranch # push local newbranch origin/newbranch
you want keep local master in sync origin/master
git checkout master git pull # , solve merge conflicts
Comments
Post a Comment