Some best practices for the Git

Git best practices:

  • Do read about git
  • Always keep develop branch clean
  • Always sync the develop branch (This can avoid lots of conflicts when try to dcommit to remote repository).
  • Don’t write any code directly in develop branch (The develop branch is not used to design any new functionality, it is used to sync with the remote repository. Each functionality should only be carried on the feature branch.)
  • Using git flow to create feature branch for each function development (Git flow has supplied a branching model and a set of convenience commands according to the branching model).
  • Docommit early and often in the feature branch (The code will be protected by theGit in the local repository).
  • Small, logical commits (Easy to track each commit’s modification).
  • Always review code before committing it
  • Using eg squash to merge all the small commits to one commit (That will make each commit in SVN to be a full functionality commit, and the history of the commits in SVN will not be fragmented).
  • Make all the commits to the SVN as a full functionality commit.
  • Make your Git sandbox your own (Some unfamiliar commands in Git should be tested in the sandbox first before executed in the development environment).
  • Do experiment, keep the trouble away from you
  • KISS -- Keep it simple and stupid
  • Do not use reset (--hard || -merge) without committing/stashing (Otherwise, the modification will be lost forever).
  • Do not rewrite public history: you can’t do it in git-svn. Lucky!!!
  • Do remember to call “git stash” when try to start a new feature branch.
  • Do remember to apply which stash in the feature branch where it saved.

Those practices are  abstracted from the practices from git-svn in a real project, but lots of the practices are still applied for the git-git workflow.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值