11# Git  
22
3- ##  ` SVN ` 与 ` Git `  
3+ ###  创建分支时打标签标记分支初始代码  
44
5- ### ` SVN ` 迁移` Git ` 可以保留提交记录,尽量保留提交记录迁移 
6- 
7- ``` shell 
8- git svn clone svn地址 --username=用户名
5+ 方便列代码清单
6+ ``` sh 
7+ git tag 分支名_init
8+ git push origin 分支名_init
9+ git diff tag1 tag2  --name-only >  diff.txt
10+ #  中文乱码解决 先改下配置
11+ git config --global core.quotepath false 
912``` 
1013
14+ 
1115### 使用` .gitignore ` 文件忽略编译后的文件和本地运行时产生的日志等  
1216
1317IDEA 提示”部分忽略的目录未从索引和搜索中排除“时,\ 
@@ -19,28 +23,16 @@ IDEA 提示”部分忽略的目录未从索引和搜索中排除“时,\
1923.svn 
2024``` 
2125
22- Git Maven 项目忽略配置参考:[ .gitignore] ( ../.gitignore ) 
26+ Git Maven 项目忽略配置参考:[ .gitignore] ( ../../. gitignore ) 
2327
2428官方文档:
2529https://mirrors.edge.kernel.org/pub/software/scm/git/docs/gitignore.html 
2630
2731
28- ### 使用` .gitkeep ` 空文件在` Git ` 中保留空文件夹  
29- 
30- ### 提交时注意作者和邮箱是否正确,避免不统一  
31- 
32- https://git-scm.com/book/zh/v2/Git-工具-重写历史 
33- 
34- 
35- ## 创建分支时打标签标记分支初始代码  
32+ ### ` SVN ` 迁移` Git ` 可以保留提交记录,尽量保留提交记录迁移 
3633
37- 方便列代码清单
38- ``` sh 
39- git tag 分支名_init
40- git push origin 分支名_init
41- git diff tag1 tag2  --name-only >  diff.txt
42- #  中文乱码解决 先改下配置
43- git config --global core.quotepath false 
34+ ``` shell 
35+ git svn clone svn地址 --username=用户名
4436``` 
4537
4638
@@ -51,21 +43,4 @@ git config core.sparsecheckout true
5143echo  " subDir/" >>  .git/info/sparse-checkout
5244git pull origin master
5345``` 
54- https://git-scm.com/docs/git-sparse-checkout 
55- 
56- ## 避免冲突  
57- 
58- ### 把会出现多人同时添加的公共文件拆分成多个  
59- 
60- 比如每个服务一个配置文件而不是在同个文件中,避免同时添加或不同分支合并出现冲突
61- 
62- 
63- ### 分工时依据修改添加哪些文件分工,必要时指定清楚  
64- 
65- 否则两个人都添加或修改了同一处就会出现冲突
66- 
67- ### 发现问题不只是改正,要对全量代码和历史数据做全面排查  
68- 
69- ### 禁止未在群中声明就修改公共代码,需要列出影响清单以便测试  
70- 
71- 
46+ https://git-scm.com/docs/git-sparse-checkout 
0 commit comments