GIT step by step
This information is for Scilab developers and code contributors. See GIT for a table of content on Git usage. If you are a user of Scilab, you probably don't need to look at this.
First step : get your own repository
[$SHELL] git clone git://git.scilab.org/scilab
It is a good idea to introduce yourself to git with your name and public email address before doing any operation. The easiest way to do so is:
[$SHELL] git config --global user.name "Your Name Comes Here" [$SHELL] git config --global user.email you@yourdomain.example.com
Switch to a branch
[$SHELL] git branch 5.3 refs/remotes/origin/5.3 [$SHELL] git checkout 5.3
Merge the master branch into YaSp branch for example
[$SHELL] git checkout master [$SHELL] git pull [$SHELL] git branch YaSp refs/remotes/origin/YaSp [$SHELL] git checkout YaSp [$SHELL] git merge master [$SHELL] git push
Switch modifications from a branch to an other branch without commit or diff
[$SHELL] edit your suff [$SHELL] git stash Saved working directory and index state ... [...] [$SHELL] git checkout 5.0 [$SHELL] git stash apply
Apply a specific modification against an other branch.
[$SHELL] git checkout 5.0 [$SHELL] git cherry-pick 2dbe5502787ae9f52faf400ab54aea0be6a43507
How can I ask git to give me the diff between a file in master and one in 5.1
[$SHELL] git diff refs/remotes/origin/master..refs/remotes/origin/5.1 scilab/Version.incl . diff --git a/scilab/Version.incl b/scilab/Version.incl . index 80e8b92..5aae442 100644 . --- a/scilab/Version.incl . +++ b/scilab/Version.incl . @@ -1 +1 @@ . -SCIVERSION=Scilab-master-GIT . +SCIVERSION=Scilab-Branch-5.1-GIT
How to find a non-pushed commit on the current tree, eg finding A on the following situation ?
o---o---o---o---* master origin/master \ A
[$SHELL] git fsck --unreachable master |awk '\$2 ~ /commit/{ print \$3}' |xargs git show --name-only . commit 280a647322a73c9d3a0f1edfd97404b1c91091a1 . Author: Clément DAVID <clement.david@scilab.org> . Date: Tue Apr 20 16:31:26 2010 +0200 . . index on master: 10130ed Xcos: scicos import Open the error dialog wh . . commit 791026c9d8685ba96e57b816e9d04d38c175ae4f . Merge: 0c05ecd 2c9531c . Author: Clément DAVID <clement.david@scilab.org> . Date: Fri Apr 9 16:59:10 2010 +0200 . . WIP on master: 0c05ecd Xcos: Scicos elements encoding/decoding Use an E . . scilab/modules/action_binding/src/java/org/scilab/modules/action_binding/Interpr . scilab/modules/xcos/src/java/org/scilab/modules/xcos/io/scicos/InputPortElement. . scilab/modules/xcos/src/java/org/scilab/modules/xcos/link/BasicLink.java . scilab/modules/xcos/src/java/org/scilab/modules/xcos/link/LinkPortMap.java