安装篇:
安装文件放在了公共服务器上,10.42.119.8 /home/software/git-all,
a.windows安装tortoiseGIT软件和Git-1.9.4-preview20140815.exe
b.linux 安装git-2.1.0.tar.gz (依赖安装zlib zlib-1.2.8.tar.gz)解压缩后有个INSTALL文件,打开看看安装指导
安装完成后,需要手动将git-manpages-2.1.0.tar.gz 解压缩把man文件手动拷贝到/usr/local/share/man/相对应的目录,注意不要文件夹覆盖,要把对应的文件夹下的文件拷贝到目录中
c.安装一些软件用于提交svn
rpm -ivh perl-Error-0.17010-1.el5.noarch.rpm
rpm -ivh perl-TermReadKey-2.30-4.el5.x86_64.rpm
rpm -ivh perl-Git-1.8.2.1-1.el5.x86_64.rpm --nodeps 注:依赖git 但是已经安装了,可能版本不一致,一般不会影响使用
rpm -ivh subversion-perl-1.4.2-2.el5.x86_64.rpm --nodeps 注:依赖svn 但是已经安装了,可能版本不一致,一般不会影响使用
rpm -ivh perl-SVN-Simple-0.27-6.el5.noarch.rpm
rpm -ivh perl-Git-SVN-1.8.2.1-1.el5.x86_64.rpm
注意修改.git/config增加下面的
[svn-remote "svn"]
url = http://10.41.212.216/svn/ZXROSNG_CODE
fetch = branches/zxrosng_dev:refs/remotes/trunk
branches = branches/{ZXROSNGV2.00.31,ZXROSNGV2.00.32,ZXROSNGV3.00.10,ZXROSNGV3.00.20}:refs/remotes/*
tags = tags/ZXROSNGV3.00.10_tags/*:refs/remotes/ZXROSNGV3.00.10_tags/*
tags = tags/ZXROSNGV3.00.20_tags/*:refs/remotes/ZXROSNGV3.00.20_tags/*
tags = tags/ZXROSNGV3.00.30_tags/*:refs/remotes/ZXROSNGV3.00.30_tags/*
c. 命令补齐功能,将解压缩的git目录中的git/contrib/completion/git-completion.bash 拷贝到一个目录
mkdir -p /etc/bash_completion.d/
cp ./contrib/completion/git-completion.bash /etc/bash_completion.d/
然后修改 ~/.bashrc文件,增加下面的部分
if [ -f /etc/bash_completion.d/git-completion.bash ]; then
. /etc/bash_completion.d/git-completion.bash
fi
设置篇:
获取帮助
git help <cmd>
1. 设置ssh无密码登陆git公共服务器
如果/root/.ssh目录下没有文件id_rsa和id_rsa.pub,则使用ssh-keygen生成这两个私钥和公钥文件。将公钥导入到git公共服务器上:ssh-copy-id -i .ssh/id_rsa.pub root@10.42.119.8
参考《git权威指南》第29.1节
2. 将公共git版本库克隆到本地:
git clone root@10.42.119.8:/home/git/rosngdev ./
3. 对git进行一些常规设置
/* 设置成自己的用户名和邮箱,设置好后通知我在git用户名和svn用户名之间进行映射 */
git config --global user.name "xxx"
git config --global user.email xxx@zte.com.cn
/* 一些缩写的设置 */
git config --system alias.st status
git config --system alias.ci commit
git config --system alias.co checkout
git config --system alias.br branch
git config --global alias.last 'log -1 HEAD'
git config --system alias.logs "log --pretty=oneline --abbrev-commit --graph"
git config --system alias.fch "fetch origin refs/remotes/*:refs/remotes/*"
git config --global alias.cleanall "clean -dfx -e .gitignore -e klocwork/"
/* linux crlf设置 * /
git config --global core.safecrlf true
git config --global core.autocrlf input
/*设置默认的pull 用--rebase选项*/
git config --global pull.rebase true
/*git merge diff工具设置*/
git config --local --unset diff.tool
git config --local --unset merge.tool
git config --global merge.tool gitmerge
git config --global mergetool.gitmerge.path /home/jenkins/scripts/vctool
git config --global mergetool.gitmerge.cmd '/home/jenkins/scripts/vctool/gitmerge $BASE $LOCAL $REMOTE $MERGED'
git config --global mergetool.prompt false
git config --global mergetool.keepBackup false
git config --global diff.tool gitdiff
git config --global difftool.gitdiff.path "/home/jenkins/scripts/vctool/"
git config --global difftool.gitdiff.cmd '/home/jenkins/scripts/vctool/gitdiff $LOCAL $REMOTE'
/*如果 difftool和mergetool出现中文乱码的情况,在 /root/.vimrc中增加下面两行*/
set fileencodings=ucs-bom,utf-8,prc,big-5,euc-jp,euc-kr
set encoding=utf-8
/*备注:svn 需要外部diff merge工具的话修改config文件*/
vi ~/.subversion/config
加入下面两行
diff-cmd = /home/jenkins/scripts/vctool/svndiff
merge-tool-cmd = /home/jenkins/scripts/vctool/svnmerge
4.忽略文件/*忽略文件 .gitignore,通过编辑该文件,对一些文件进行忽视,这个规则只能针对不受控文件*/
.gitignore
code/arch/target/
code/md_ftm/include/
code/md_ftm/source/
code/php/tools/MakeRule/BatchRun.pyc
code/php/tools/package/VersionInfo.pyc
code/php/tools/package/parse_argv.pyc
code/php/tools/package/pkg_cfg.pyc
code/php/tools/package/pkg_file.pyc
code/php/tools/package/pkg_squashfs.pyc
code/php/tools/package/pkg_zip.pyc
code/php/tools/package/sdl.pyc
code/php/tools/package/zipinfo.pyc
code/rosng/capz/include/
code/rosng/capz/source/
code/rosng/target/
code/tulip/target/
make/.make_lib.csv
sim/product/make/.make_process.csv
sim/product/make/xmlCheck0.log.0
sim/product/make/xmlCheck0.log.1
sim/product/prjcfg/.depend.log
sim/product/prjcfg/.rule.cfg
sim/product/prjcfg/.rule.dep
sim/product/prjcfg/.tar_all_and_clean.mak
sim/product/prjcfg/router/pkg/.target
sim/product/prjcfg/router/pkg/log/
sim/target/
sim/project/prj_pc/make/common/x86_64/default/
target/
klocwork/
.gitignore
安装文件放在了公共服务器上,10.42.119.8 /home/software/git-all,
a.windows安装tortoiseGIT软件和Git-1.9.4-preview20140815.exe
b.linux 安装git-2.1.0.tar.gz (依赖安装zlib zlib-1.2.8.tar.gz)解压缩后有个INSTALL文件,打开看看安装指导
安装完成后,需要手动将git-manpages-2.1.0.tar.gz 解压缩把man文件手动拷贝到/usr/local/share/man/相对应的目录,注意不要文件夹覆盖,要把对应的文件夹下的文件拷贝到目录中
c.安装一些软件用于提交svn
rpm -ivh perl-Error-0.17010-1.el5.noarch.rpm
rpm -ivh perl-TermReadKey-2.30-4.el5.x86_64.rpm
rpm -ivh perl-Git-1.8.2.1-1.el5.x86_64.rpm --nodeps 注:依赖git 但是已经安装了,可能版本不一致,一般不会影响使用
rpm -ivh subversion-perl-1.4.2-2.el5.x86_64.rpm --nodeps 注:依赖svn 但是已经安装了,可能版本不一致,一般不会影响使用
rpm -ivh perl-SVN-Simple-0.27-6.el5.noarch.rpm
rpm -ivh perl-Git-SVN-1.8.2.1-1.el5.x86_64.rpm
注意修改.git/config增加下面的
[svn-remote "svn"]
url = http://10.41.212.216/svn/ZXROSNG_CODE
fetch = branches/zxrosng_dev:refs/remotes/trunk
branches = branches/{ZXROSNGV2.00.31,ZXROSNGV2.00.32,ZXROSNGV3.00.10,ZXROSNGV3.00.20}:refs/remotes/*
tags = tags/ZXROSNGV3.00.10_tags/*:refs/remotes/ZXROSNGV3.00.10_tags/*
tags = tags/ZXROSNGV3.00.20_tags/*:refs/remotes/ZXROSNGV3.00.20_tags/*
tags = tags/ZXROSNGV3.00.30_tags/*:refs/remotes/ZXROSNGV3.00.30_tags/*
c. 命令补齐功能,将解压缩的git目录中的git/contrib/completion/git-completion.bash 拷贝到一个目录
mkdir -p /etc/bash_completion.d/
cp ./contrib/completion/git-completion.bash /etc/bash_completion.d/
然后修改 ~/.bashrc文件,增加下面的部分
if [ -f /etc/bash_completion.d/git-completion.bash ]; then
. /etc/bash_completion.d/git-completion.bash
fi
设置篇:
获取帮助
git help <cmd>
1. 设置ssh无密码登陆git公共服务器
如果/root/.ssh目录下没有文件id_rsa和id_rsa.pub,则使用ssh-keygen生成这两个私钥和公钥文件。将公钥导入到git公共服务器上:ssh-copy-id -i .ssh/id_rsa.pub root@10.42.119.8
参考《git权威指南》第29.1节
2. 将公共git版本库克隆到本地:
git clone root@10.42.119.8:/home/git/rosngdev ./
3. 对git进行一些常规设置
/* 设置成自己的用户名和邮箱,设置好后通知我在git用户名和svn用户名之间进行映射 */
git config --global user.name "xxx"
git config --global user.email xxx@zte.com.cn
/* 一些缩写的设置 */
git config --system alias.st status
git config --system alias.ci commit
git config --system alias.co checkout
git config --system alias.br branch
git config --global alias.last 'log -1 HEAD'
git config --system alias.logs "log --pretty=oneline --abbrev-commit --graph"
git config --system alias.fch "fetch origin refs/remotes/*:refs/remotes/*"
git config --global alias.cleanall "clean -dfx -e .gitignore -e klocwork/"
/* linux crlf设置 * /
git config --global core.safecrlf true
git config --global core.autocrlf input
/*设置默认的pull 用--rebase选项*/
git config --global pull.rebase true
/*git merge diff工具设置*/
git config --local --unset diff.tool
git config --local --unset merge.tool
git config --global merge.tool gitmerge
git config --global mergetool.gitmerge.path /home/jenkins/scripts/vctool
git config --global mergetool.gitmerge.cmd '/home/jenkins/scripts/vctool/gitmerge $BASE $LOCAL $REMOTE $MERGED'
git config --global mergetool.prompt false
git config --global mergetool.keepBackup false
git config --global diff.tool gitdiff
git config --global difftool.gitdiff.path "/home/jenkins/scripts/vctool/"
git config --global difftool.gitdiff.cmd '/home/jenkins/scripts/vctool/gitdiff $LOCAL $REMOTE'
/*如果 difftool和mergetool出现中文乱码的情况,在 /root/.vimrc中增加下面两行*/
set fileencodings=ucs-bom,utf-8,prc,big-5,euc-jp,euc-kr
set encoding=utf-8
/*备注:svn 需要外部diff merge工具的话修改config文件*/
vi ~/.subversion/config
加入下面两行
diff-cmd = /home/jenkins/scripts/vctool/svndiff
merge-tool-cmd = /home/jenkins/scripts/vctool/svnmerge
4.忽略文件/*忽略文件 .gitignore,通过编辑该文件,对一些文件进行忽视,这个规则只能针对不受控文件*/
.gitignore
code/arch/target/
code/md_ftm/include/
code/md_ftm/source/
code/php/tools/MakeRule/BatchRun.pyc
code/php/tools/package/VersionInfo.pyc
code/php/tools/package/parse_argv.pyc
code/php/tools/package/pkg_cfg.pyc
code/php/tools/package/pkg_file.pyc
code/php/tools/package/pkg_squashfs.pyc
code/php/tools/package/pkg_zip.pyc
code/php/tools/package/sdl.pyc
code/php/tools/package/zipinfo.pyc
code/rosng/capz/include/
code/rosng/capz/source/
code/rosng/target/
code/tulip/target/
make/.make_lib.csv
sim/product/make/.make_process.csv
sim/product/make/xmlCheck0.log.0
sim/product/make/xmlCheck0.log.1
sim/product/prjcfg/.depend.log
sim/product/prjcfg/.rule.cfg
sim/product/prjcfg/.rule.dep
sim/product/prjcfg/.tar_all_and_clean.mak
sim/product/prjcfg/router/pkg/.target
sim/product/prjcfg/router/pkg/log/
sim/target/
sim/project/prj_pc/make/common/x86_64/default/
target/
klocwork/
.gitignore