安装git
centos
yum -y install git
ubuntu
git命令
下载远程仓库代码默认分支
git clone url下载指定分支
git clone url -b dev_branch切换分支
git checkout b1删除本地未提交(uncommit修改过的)代码
git clean -xdf查看当前分支
git branch合并另一个分支代码到当前分支
git merge dev带合并记录,方便追溯
git merge dev –no-ff不产生合并记录
git rebase dev
记住密码
bash操作
git config –global credential.helper store修改~/.gitconfig文件
1
2[credential]
helper = storegit config –global user.email “you@example.com“
git config –global user.name “Your Name”
提交
添加远程仓库地址
git remote add origin git@192.168.5.166:lixl/p2m-sf-history.git推送到本地到远程分支
git push origin b_local:b_remote
jgit
从svn迁移到git
1 | #yum -y install git-svn |
爬坑-使用windows转换时,如果svn历史记录里有大量的文件删除操作,在转换为git记录时可能会出错;
使用linux进行改操作比较好。