1. The clone code

Git clone git:mt8735_m0_v1.0.3

Clone code, default for the master branch, remote branch for remote/ Origin /master. HEAD points to the current branch (master). In remote/ Origin /master, Origin is the default name of the remote machine and master is the name of the remote branch. Here is:




Note: In the. Git directory, run the SCP git:hooks/commit -msg. git/hooks/ command

2. Bug branch (e.g. Mantis100 for modifying bug#100 on Mantis)

Git checkout -b mantis100

Note: After the command is executed, the mantis100 branch is automatically created and switched to, so HEAD points to this branch (Mantis100).

Here is:




3. Modify bug#100 and commit on the mantis100 branch

Git add, git commit

Note: while modifying bug#100, there will be new commits (S4, S5) on the server. The mantis100 branch pointer moves with the commit, always referring to the last commit of the current branch (L1, L2). Since there is no direct commit on the master branch, the master pointer remains unchanged. The remote/origin/master pointer remains unchanged until it is synchronized with the server (via fetch, pull, etc.). Here is:




4. Use the FETCH command to fetch updates on the server

Git fetch origin command

Note: The FETCH will only pull updates from the server to the local, and will not merge with the local master branch. Remote/Origin/Master will always point to the last remote change retrieved. Here is:




5. Switch to master branch

Git checkout master

Mantis100 and master remain the same

Here is:




6. Run the rebase command to update the master branch

Git rebase origin/master

Description: Since no changes have been committed locally on the master branch, this command does not cause a merge action. Only move the pointer to the master branch to the node pointed to by remote/ Origin /master. Here is:




7. Run the cherry-pick command to append the modification on the mantis100 branch

Git cherry-pick L1, git cherry-pick L2

Note: Selectively append L1 or L2 to the end of the master branch and the appended changes will be pushed to the server.

Here is:




8. Delete the Mantis100 branch

Git branch -d mantis100

Note: At this point, the changes on Mantis100 have been appended to the master branch for push, so the mantis100 branch has completed its historical mission and can be deleted. It is not recommended to continue development on this branch, as it can lead to complex dependencies between branches.

Here is:




9. Run the push command to push the changes to the Review server

Git push origin HEAD:refs/for/master

Note: On the master branch, changes made after remote/ Origin /master will be pushed to the code review server.

Note: steps 5 through 7 can also be implemented by using the rebase directive directly on the mantis100 branch. The basic idea is as follows:

When remote/origin/master has been updated with the fetch command, on the mantis100 branch:

Git rebase origin/master: git rebase origin/master

2. If a conflict occurs during rebase, manually resolve the conflict, add the modified file, and run rebase -continue

3. Switch back to master and rebase the master branch directly to mantis100

4. Delete the Mantis100 branch.