Git 怎么样提交才会清晰?
PHPz
PHPz 2017-04-24 09:13:44
0
6
641

假如我开发一个软件需要用到git来管理,这个软件有很多的功能模块,请问:

1、每实现一个功能功能就只commit一次吗?

2、只要觉得有commit的必要就commit,比如修改个小bug,然后commit

我是新手,每次提交修改的文件都很多,很乱,有些修改还是和这次commit无关的文件。

请问各位是怎么做的呢? 谢谢。

PHPz
PHPz

学习是最好的投资!

reply all(6)
迷茫

You can refer to git flow. I think it can solve your doubts from a big point

http://danielkummer.github.io/git-flow-cheatsheet/index.zh_CN.html

Generally, there are several branches: master develop, various feature branches, bug_fix branch, hot_fix branch
Master is generally the official online version. Needless to say, develop is developed, but the branch placed in develop is already a relatively stable branch. When you want to develop new features, make sure you create a new feature_XXX branch on the develop branch. Various commit commit commit,
If a bug is found in the previous version later, a bug_fix_XXX branch will be created if it does not affect the online version, and a hot_fix branch will be created for serious bugs that affect the online version. hot_fix is ​​different from bug_fix. After the bug is solved, the hot_fix branch will be merged to the master. It's master.

Also, if you want to keep your branch neat and clean, you may need to use rebase to merge the code instead of merge

For git stuff, I recommend checking out progit, it’s very comprehensive.

洪涛

I usually am

  1. branch branch
  2. commit, commit, commit, commit…
  3. Fixed a bug or solved a problem merge
  4. commit, commit, commit, commit… merge
  5. pull
大家讲道理

Even if you just add a line of code, it can be treated as a commit.
Do not submit irrelevant code to this commit.

You need to know that the effect you want to achieve is that if one day I want you to roll back to a certain historical state, you can quickly find that submission and roll back. If you can't do this, it doesn't matter how you commit.
For example, once you change a default value from 50 to 100, then this should be treated as a commit. If you fix a bug by accident, it cannot be included in this commit. Otherwise, how can you roll it back to 50? Do you need to fix the bug again after rolling it back?

You don’t know how to submit because you don’t have a definite purpose.

I think so.

巴扎黑

If you want to be very detailed, you can only submit a specific function.
But it’s so troublesome.
In addition, you can also use git gui to submit in Chinese and describe it clearly.

迷茫

This is optional. It is mainly for the convenience of yourself or others in the future. I will also make it clear in the commit information of your commit information that you have changed those pages that have nothing to do with the function. Anyway, if you are diligent in committing, submitting a feature once is definitely not enough

洪涛

Use rebase more and merge less

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template