AGit-Flow: Alibaba's centralized Git workflow

更新时间:
复制 MD 格式

AGit-Flow is Alibaba's centralized workflow for standardized code management.

Imagine:

  • What if creating a code review was as simple as running the git push command?

  • Developers can create a code review in seconds instead of minutes, without switching between tools.

Adopting AGit-Flow and using thegit-repo tool accelerates your code review process and standardizes your workflow.

What is AGit-Flow?

AGit-Flow is a centralized Git workflow that combines the user-friendly ecosystem of GitHub with the powerful code review capabilities of Gerrit.

AGit-Flow does not require a forked repository or feature branch. Even users with read-only permissions can create a code review using the git push command.

A companion command-line tool, git-repo, supports this workflow. It works with single repositories and supports multi-repository collaboration, similar to the Android project model.

The AGit-Flow workflow

The following diagram illustrates the AGit-Flow workflow for a single repository.

The workflow works as follows:

Developer

A developer follows these steps to create and update a pull request:

  1. Clone the repository.

  2. Develop and create commits in the local repository.

  3. Run the git pr command in your workspace to push local commits to the server.

  4. The server automatically creates a new code review, for example, pull request #123.

  5. Incorporate review feedback by adding new commits or amending existing ones in the local workspace.

  6. Run the git pr command again in the workspace to push the local commits to the server.

  7. The server detects an existing pull request from the same user for the target branch and updates it, rather than creating a new one.

Committer

A committer can provide review feedback and directly modify the code under review to update the pull request:

  1. The committer runs the git download 123 command to download pull request #123 to their local repository.

  2. After modifying the code locally, the committer runs the git pr --change 123 command to push the changes to the server.

  3. The server receives the committer's special git push command and updates the pull request.

  4. A project manager clicks the Merge button on the pull request review page to merge the pull request into the master branch. This action updates the master branch and closes the pull request.

The steps above describe the AGit-Flow workflow for a single repository.

For a demonstration of multi-repository collaboration, see https://git-repo.info/en/docs/multi-repos/overview/.

Git-repo tool

git-repo is an open-source command-line tool from Alibaba. It wraps native Git commands to simplify operations in a centralized workflow like AGit-Flow.

git-repo supports AGit-Flow-compatible code hosting platforms as well as Gerrit. For downloads, see Tool Download.