How to copy (upload) the code file to another branch in the environment of a certain branch in gitee

1. git clone <address>

    For example 

                git clone https://gitee.com/xuexiluxian/vue-tea.git

    *** Code cloned under master branch
 

2. Specify the branch to clone the code

    git clone -b branch name address

Say the important thing three times, see the bold part below! ! ! 3.1~3.3 high-end operation


 

3. It is under the remote dev branch, but the upload code is on a certain branch

   

    3.0 Configure local identity (configuration can be ignored)

        git config user.name 'Deer Line-Zhang Sansan'

        git config user.email '[email protected]'

    3.1 Look at the log under the dev branch

        git log

        **Record hash Here you need to record the hash value after commit

    3.2 Pull the remote branch to the local warehouse

        git checkout --track <full name of remote branch>

         The remote branch here is the branch you want to upload the code to. It is currently in the dev branch. For example, upload it to  the origin/feature/home branch .

For example:

        git checkout --track origin/feature/home

   3.3 Merge the code submitted by the hash value corresponding to the dev branch commit into the home branch

        git cherry-pick <hash code>

For example:

    git cherry-pick 0fd8cb514e6b74f871f75044978c1c8c95c251ad

In this way, the code content of the version corresponding to the hash value  of the dev branch will be uploaded to   the feature/home branch


 

Guess you like

Origin blog.csdn.net/m0_65450343/article/details/125939457