Git Workflow Best practices

前端 未结 5 1738
长情又很酷
长情又很酷 2021-02-01 08:53

Stupid question and treat me as completely a newbie to version control.

I\'m new to Git (I\'ve used subversion before, but just the basics) I understand the basics of G

5条回答
  •  盖世英雄少女心
    2021-02-01 09:16

    GIT is very flexible and you can tailor your usage to your specific scenario. That said, I like the branch-per-feature approach and I also prefer "rebasing" to merging.

    Branch-per-feature means you create a branch for each feature or defect you are working on. Typically the branch only lives as long as the development and is deleting once it is merged/rebased with the master.

    Rebase means that instead of having the branch merge with the master you actually pull the changes from master down and puts them in front of all the changes you made in your branch. In essence it merges the HEAD with the beginning of your branch changes. This makes it seems as if all the changes you are merging began after the the latest HEAD revision.

    It is also good practice to push your branches to the remote repository, in case someone else needs to look at or work with the branch, also it provides a backup of your work. Again when you are done with a branch I suggest cleaning up after and deleting old branches.

    Finally, one last best practice is to keep your commits small, specific to one particular task or action so that each commit can be examined easily by others and what was done quickly understood. Commits can then serve to document your progress and activities.

提交回复
热议问题