Sunday, September 23, 2012

Basic git commands

//Adding to git repository
$ git init
$ git add .
$ git commit

//To see logs
$ git log
git log HEAD/HEAD~1/HEAD~2

//creating patch
git add <filepath/file name>
git commit
git format-patch HEAD~1

//applying patch
git apply --stat fix_empty_poster.patch
git apply --check fix_empty_poster.patch
git am --signoff < fix_empty_poster.patch

//Undo changes
git reset --hard HEAD ; reset to HEAD
git reset HEAD ; it will keep unstaged changes

Steps to submit a patch in git :
clone the branch
git clone <branch addess> -b <local repo name>
1. git reset --hard <commit id>
2. git remote update
3. git pull
4. Add the modified files to repository you created
    $ git add file1 file2 file3
5. We can see what is about to be committed using git diff with the --cached option.
    $ git diff --cached
    $ git status
6. Before commiting our Changes in GIT, run the script if any. e.g. testScript.pl script    
     $ git diff --cached| <path>/testScript.pl  --no-signoff -
7. commit your changes.
    $ git commit -s
8. Push Your changes
    $ git push

setting cpu frequency, and governors

Following files can be used to manipulate cpu frequency
"/sys/devices/system/cpu/cpu0/cpufreq/" .

>cd sys/devices/system/cpu/cpu0/cpufreq/

To set the cpu at maximum frequency ,
>echo performance > scaling_governor
verify it by 
>cat cpuinfo_cur_freq 
it should be 1GHz.

To choose the max and min limit of scaling frequency.
>echo conservative > scaling_governor
>echo maxfreq > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
>echo minfreq  > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
After this cpu will scale the cpu frequency between maxfreq and minfreq.

To force the cpu to run at particular frequency
> echo conservative > scaling_governor
> echo 800000  > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> echo 800000  > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
 verify it by 
> cat cpuinfo_cur_freq
it should be 800000.

To set the cpu at lowest frequency .
>echo powersave > scaling_governor
verify it by 
>cat cpuinfo_cur_freq
it should be 100000.