工具推荐: 版本控制

Git

Subversion

个人推荐

Git 图形客户端

根据我的使用经验,推荐以下工具:

  • GitHub Desktop:最适合初学者和 GitHub 用户

    • 界面简洁,学习成本低
    • 与 GitHub 集成度最高
    • 开源免费
  • Fork:功能强大且美观

    • 支持高级 Git 操作
    • 界面设计现代化
    • 性能优秀
  • SourceGit:轻量级开源选择,不过我不喜欢这个,丑和不好用。

    • 跨平台支持
    • 功能全面
    • 社区活跃

Git 常用配置

设置用户信息

1
2
git config --global user.name "你的名字"
git config --global user.email "你的邮箱"

设置默认分支名

1
git config --global init.defaultBranch main

设置编辑器

1
git config --global core.editor "code --wait"

启用颜色输出

1
git config --global color.ui auto

常用 Git 别名

1
2
3
4
5
6
7
8
# 简化常用命令
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1'
git config --global alias.visual 'log --graph --oneline --all --decorate'

推荐的工作流

Git Flow 工作流

适用于需要管理发布周期的项目:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 安装 git-flow
brew install git-flow  # macOS
apt install git-flow   # Linux

# 初始化
git flow init

# 创建功能分支
git flow feature start feature-name

# 完成功能分支
git flow feature finish feature-name

简化工作流

适用于个人项目或小团队:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 创建功能分支
git checkout -b feature-name

# 提交更改
git add .
git commit -m "描述更改"

# 推送到远程
git push -u origin feature-name

# 合并到主分支
git checkout main
git merge feature-name
git push origin main

其他资源


这篇文章记录了我常用的版本控制工具和配置。选择合适的工具可以提高开发效率,建议根据自己的需求和使用习惯进行选择。

comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计