Git 工作流程提示

发布于 12-05 18:33 字数 203 浏览 2 评论 0原文

我开始使用 git 并且已经使用了几个月了,我很好奇我的工作流程是否正确。我在这个项目的两个不同地方工作。以下是我的工作流程的各个阶段:

  1. 我从远程存储库中提取项目
  2. ,为新功能创建本地分支,
  3. 进行更改并提交
  4. 将分支与主
  5. 推送合并到远程,

这是处理项目的正确方法吗?

I started using git and have been using it for couple of months now, and I am curious if my workflow is correct. I work from two different places on the project. here are the stages of my workflow:

  1. I pull the project from remote repo
  2. make a local branch for a new feature
  3. make changes and commit
  4. merge the branch with master
  5. push to the remote

is this correct way of working on the project?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

×眷恋的温暖2024-12-12 18:33:50

正如琥珀所说:

首先,让我们明确一点:没有单一的“正确”
Git 的工作流程。只有有效的工作流程 - 并且
具体来说,适合您的工作流程。

博客上有一篇关于良好 git 工作流程的好文章:

成功的 Git 分支model

您应该阅读这篇文章,它真的很酷,您可以根据您的需求调整工作流程。
简而言之,博客文章提出的工作流程如下所示:

A success gitbranching model

我已采用此工作流程一会儿。我尝试始终尊重工作流程,无论是团队合作还是单独工作。

As Amber said :

First, let's just make something clear: there is no single "correct"
workflow for Git. There are merely workflows that work - and
specifically, workflows that work for you.

There is a good post on a blog about a good git workflow :

A successful Git branching model

You should read this post, it's really cool and you can adapt the workflow to your needs.
In a nutshell, the workflow proposed by the blog post schematized like this :

A successful git branching model

I have adopted this workflow for a while. I try to always respect the workflow, whether it's a teamwork or working alone.

鹿港巷口少年归2024-12-12 18:33:50

首先,让我们明确一点:Git 不存在单一的“正确”工作流程。只有工作的工作流程 - 特别是为您工作的工作流程。

您概述的工作流程通常称为“功能分支”工作流程(您创建一个分支来处理给定的功能/修复/任何内容,然后将其合并回来),并且是一个完全合法的工作流程。

如果您一次只处理一个功能,您可以选择直接提交到 master,然后推送更新的版本。然而,如果您同时处理多个不同的功能(而功能分支工作流程可以优雅地处理许多同时出现的功能),这就变得很困难。

First, let's just make something clear: there is no single "correct" workflow for Git. There are merely workflows that work - and specifically, workflows that work for you.

The workflow you have outlined is typically referred to as a "feature branch" workflow (where you create a branch to work on a given feature/fix/whatever, and then merge it back), and is a perfectly legitimate workflow.

If you only ever work on a single feature at a time, you could choose to simply commit directly to master, then push the updated version. This becomes difficult, however, if you're working on multiple different features simultaneously (whereas a feature branch workflow handles many simultaneous features gracefully).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文