github - Git pull origin <branch> overwrites master? -


i have repository on github, aav1

on laptop have 2 branches, 1 called master , 1 called vs12up master branch when software visual studio 2008, vs12up converted visual studio 2012.

on laptop seems fine , pushed new branch github, appears correct.

on desktop tried pull remote branch:

git pull origin vs12up 

it wrote changes master branch on desktop, git log shows commits made on vs12up branch, git branch shows master, current branch.

how can revert changes master branch , pull vs12up branch on desktop match repository on laptop?

if git pull remote branch name, fetch remote branch , merge current local branch. undo that, first have reset local branch remote master, create new local vs12up branch corresponding remote branch.

  1. reset local master match remote repository's master (warning: sure don't have uncommitted changes want keep before issuing following command):

    git reset --hard origin/master 
  2. fetch remote branches local repository:

    git fetch origin 
  3. create new local vsup12 branch remote vsup12 branch, , switch new local branch:

    git checkout -b vsup12 origin/vsup12 

note when subsequently git pull while switched vsup12 branch, you'll fetch , merge latest changes vsup12 branch on github local vsup12


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -