GIT: Moving between the master and a branch
This information is for Scilab developers and code contributors. See GIT for a table of content. If you are a user of Scilab, you probably don't need to look at this.
In this page, we describe a regular git session during the development of Scilab: we want to go one another branch so that we can (later) commit in that particular branch.
Contents
We assume that, at the start, we are on the master branch.
Moving from the master to the 5.3 branch
Here is a summary.
1. Going on the 5.3 branch:
git branch 5.3 origin/5.3 git checkout 5.3 git branch -D master
2. Getting clean
git fetch git reset --hard remotes/origin/5.3
Here is the detailed session.
Going on the 5.3 branch
myname@mymachine /git-scilab/scilab/scilab/modules (master) $ git branch 5.3 origin/5.3 Branch 5.3 set up to track remote branch 5.3 from origin. myname@mymachine /git-scilab/scilab/scilab/modules (master) $ git checkout 5.3 Switched to branch '5.3' myname@mymachine /git-scilab/scilab/scilab/modules (5.3) $ git branch -D master Deleted branch master (was 9a83f76).
Getting clean
myname@mymachine /git-scilab/scilab/scilab/modules (5.3) $ git fetch myname@mymachine /git-scilab/scilab/scilab/modules (5.3) $ git reset --hard remotes/origin/5.3 HEAD is now at 32279e2 added const modifiers to parameters of create*SparseMatrixIn*List() myname@mymachine /git-scilab/scilab/scilab/modules (5.3) $ git status # On branch 5.3 nothing to commit (working directory clean)
Moving from the 5.3 branch to the master
Here is a summary.
1. Going on the master
git checkout master git branch -D 5.3
2. Getting clean
git fetch git reset --hard remotes/origin/master
Going on the master
myname@mymachine /git-scilab/scilab/scilab/modules (5.3) $ git status # On branch 5.3 nothing to commit (working directory clean) myname@mymachine /git-scilab/scilab/scilab/modules (5.3) $ git checkout master Branch master set up to track remote branch master from origin. Switched to a new branch 'master' myname@mymachine /git-scilab/scilab/scilab/modules (master) $ git branch -D 5.3 Deleted branch 5.3 (was 32279e2).
Getting clean
myname@mymachine /git-scilab/scilab/scilab/modules (master) $ git fetch Enter passphrase for key '/c/Users/myname/.ssh/id_rsa': myname@mymachine /git-scilab/scilab/scilab/modules (master) $ git reset --hard remotes/origin/master HEAD is now at 9a83f76 fminsearch: fixed typo in example of help page