git历史commit用户名密码修改

1
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='SimilarSu'; GIT_AUTHOR_EMAIL='similarsu@qq.com'; GIT_COMMITTER_NAME='sutong'; GIT_COMMITTER_EMAIL='821192673@qq.com';" HEAD

其中GIT_AUTHOR为新的,GIT_COMMITTER为老的

svn如何迁移到git

背景

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
svn仓库doc目录结构如下:
- test
- trunk
- src
- test
- branches
- 1.0.0
- src
- test
- 2.0.0
- src
- test
- tags
- v1.0.0
- src
- test
- v2.0.0
- src
- test
- test2
- trunk
- code
- src
- test
- branches
- 1.0.0
- code
- src
- test
- tags
- 1.0.0
- code
- src
- test
阅读更多

svn备份迁移

背景

1
2
3
4
5
6
7
8
9
需要将10.1.1.1主机上的svn仓库迁移到10.1.1.2主机上
10.1.1.1上svn结构如下:
E:/svnrepo
---firstrepo
---secondrepo
---thirdrepo

10.1.1.2上结构如下:
F:/svnrepo

注意:将svn相关命令配置到环境变量中

备份

进入10.1.1.1的E:/svnrepo

导出仓库firstrepo

1
svnadmin dump firstrepo > F:/firstrepo.dump
阅读更多

git bug分支流程

背景

1
正式版本1.0.0发布后,发现bug,需创建bug分支,进行修补

从master分支中分出分支fixbug-1.0.0

1
git checkout -b fixbug-1.0.0 master

修复分支,并提交

切换到master分支

1
git checkout master
阅读更多

git发布正式版本流程

背景

1
1.0.0-SNAPSHOT开发完成后,需要发布正式版本1.0.0

创建预发布分支

1
git checkout -b release-1.0.0 develop

修改版本号

提交修改

切换到master分支

1
git checkout master
阅读更多

git打标签

背景

1
以develop分支某一时间点,打标签,加上发布内容,发布到git服务器。

切换分支

1
git check develop

更新代码

1
git pull origin develop

查看日志

1
git log
阅读更多

linux下git默认编辑器修改

背景

1
git默认的编辑器是nano,使用起来不方便。

执行如下命令,修改默认编辑器为vim。

1
git config --global core.editor vim

打开~/.gitconfig文件查看

1
2
[core]
editor=vim

git push免输入账号和密码

创建文件,加入如下内容

1
2
3
4
cd ~
touch .git-credentials
vi .git-credentials
https://{username}:{password}@{domain}{:port}

执行如下命令

1
git config --global credential.helper store

打开~/.gitconfig文件查看

1
2
[credential]
helper = store

如何clone包含子模块的工程

目前有两种方式

clone整个项目

1
git clone git@github.com:sutong/landscape-theme-extends-demo.git --recursive

先clone父项目,再更新子项目

1
2
3
git clone git@github.com:sutong/landscape-theme-extends-demo.git
git submodule init
git submodule update

最后记得进入子模块所在的目录,追踪master分支

1
git checkout master