Archive for the ‘Subversion’ Category

Github and Git commands

Wednesday, June 6th, 2012

1)How to clone a git repo into a new computer
Ref:https://help.github.com/articles/fork-a-repo

git clone git@github.com:username/Spoon-Knife.git

2) push code from cloned repo

git push origin master

3)

Linux SVN/Subversion Usefull commands

Thursday, February 25th, 2010

Ref:http://svnbook.red-bean.com/en/1.5/svn.tour.cycle.html#svn.tour.cycle.update

(A) How to install and Import directory into repository:
Click here

(B)How to get working copy from svn repository into local machine?
Goto Your home directory , example : cd /root
Now execute bellow commands

[root@mail ~]# svn checkout file:///svn
A    svn/script
A    svn/script/checkmemory.sh
A    svn/config
A    svn/config/httpd-vhosts
Checked out revision 2.

Now you will see there is a directory call svn has been created in to your home directory and this svn has all the files we added before
Example :

[root@mail ~]# ls
 rpmforge-release-0.3.6-1.el5.rf.i386.rpm
epel-release-5-3.noarch.rpm  script
svn
[root@mail ~]# cd svn
[root@mail svn]# ls
config  script
[root@mail svn]# cd script/
[root@mail script]# ls
checkmemory.sh
[root@mail script]# pwd
/root/svn/script
[root@mail script]#

NOte : If you want to just check out only one directory example script. then command would be :

[root@mail ~]# svn checkout file:///svn/script
A    script/checkmory.sh
Checked out revision 2.

(C) How to get the Updated copy of the working directory

[root@mail script]# svn update
U    checkmemory.sh
Updated to revision 3.
[root@mail script]#

While you are working on a file.if any one changes to that file and you want to download those changes, then svn update will give the up to date file.

(D) How to add directory or file to the repository

[root@mail script]# svn add check_cpu.sh check_memory.sh
A         check_cpu.sh
A         check_memory.sh
[root@mail script]#
 
Note : Dont forget to run bellow command to make the update permanently
svn commit

(E) How to delete file or directory

 [root@mail script]# svn delete check_memory.sh 
D         check_memory.sh

(F) How to view overall changes of local modifications

[root@mail script]# svn status
A       check_ping
M       check_cpu.sh
[root@mail script]#

(G) How to view the details of local modifications

For Every modifications( every files)
[root@mail script]# svn diff
Index: check_ping
===================================================================
--- check_ping  (revision 0)
+++ check_ping  (revision 0)
@@ -0,0 +1 @@
+This is a test insert
Index: check_cpu.sh
===================================================================
--- check_cpu.sh        (revision 4)
+++ check_cpu.sh        (working copy)
@@ -0,0 +1 @@
+This is a test line
[root@mail script]#
 
For a particular file:
 
[root@mail script]# svn diff check_cpu.sh
Index: check_cpu.sh
===================================================================
--- check_cpu.sh        (revision 4)
+++ check_cpu.sh        (working copy)
@@ -0,0 +1 @@
+This is a test line
[root@mail script]#

(H) How to commit changes ( update your working copy with svn repository)

   svn commit

Before committing , it will open vim editor and you need to insert some comments about what you updating for your/Other peoples references.

(I) How to check history ?
Ref :http://svnbook.red-bean.com/en/1.5/svn.tour.history.html

[root@mail script]# svn log
------------------------------------------------------------------------
r5 | root | 2010-02-25 14:10:45 +0000 (Thu, 25 Feb 2010) | 3 lines
 
Added Check_ping file
Modified check_cpu file
 
------------------------------------------------------------------------
r4 | root | 2010-02-25 13:55:01 +0000 (Thu, 25 Feb 2010) | 2 lines
 
Added Check_cpu and Delete check_memory.sh file
 
------------------------------------------------------------------------
r3 | root | 2010-02-25 13:42:52 +0000 (Thu, 25 Feb 2010) | 2 lines
 
Just update
 
------------------------------------------------------------------------
r1 | root | 2010-02-25 11:19:54 +0000 (Thu, 25 Feb 2010) | 2 lines
 
Just Adding a directory
 
------------------------------------------------------------------------

Meaning of A,C,D,M:

A item
 
    The file, directory, or symbolic link item has been scheduled for addition into the repository.
C item
 
    The file item is in a state of conflict. That is, changes received from the server during an update overlap with local changes that you have in your working copy (and weren't resolved during the update). You must resolve this conflict before committing your changes to the repository.
D item
 
    The file, directory, or symbolic link item has been scheduled for deletion from the repository.
M item
 
    The contents of the file item have been modified.

How to install Subversion

Thursday, February 25th, 2010

Ref:http://svnbook.red-bean.com/en/1.5/index.html

(A) To install Subversion : yum install mod_dav_svn subversion
(B) How to create a Repo :

svnadmin create /svn

So it will create a svn directory under / directory

[root@mail /]# pwd
/
[root@mail /]# ls
aquota.group  boot      dev   lib    opt   sbin     svn  usr
aquota.user   conffile  etc   media  proc  selinux  sys  var
bin           data      home  mnt    root  srv      tmp
[root@mail /]#

(C) How to import Directory in svn repos ?

 svn import directory/ file:///svn/directory

output :

[root@mail /]# svn import /root/script/ file:///svn/script
Adding         /root/script/checkmory.sh
 
Committed revision 1.

Note After typing the svn import command it will open a Vim editor ,and will ask you to write some comments about this import
Example: I would of write: I am adding the /root/script directory into svn repository.
Pic:

Svn Asking to input comments before adding directory to repository

Svn Asking to input comments before adding directory to repository

Note : if you see bellow error :

svn: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found

which means: you need to add “vim ” program path into bash_profile files

How to add vim programm path in .bash_profile file :

vi /root/.bash_profile
add this line :
export SVN_EDITOR="/bin/vi"

Now save the file and logoff and log on agian

(d) How to check list of projects in svn repo

[root@mail /]# svn list file:///svn

Output :

script/

Which means script directory has been added into svn repository.
Now if you want to see what is inside script directory

[root@mail /]# svn list file:///svn/script
checkmemory.sh