git local code submission to remote master branch solution

Git submits the code, creates a new my branch locally, does not upload directly from the local master branch, but first submits it from the local my branch to the local master branch, and then submits the local master to the remote master branch
. The premise is that there is only one master branch on the remote.
Step 1: Go to the project directory first. Open the git bash command box
Part 2: Create a local my branch, git checkout -b my (if the my branch already exists, git checkout my directly switches to the my branch)
Part 3: Submit the changes on the local my branch to the cache area ,
        git add . (commit all modifications), or only modify a certain file, you can git add file path + file name to submit
        git commit -m "remarks"
        Note: After this step, the modified code has been submitted to the cache of my branch Section
4: Switch to master, git checkout master;
        first of all, remember to update the local master branch with the code of the remote master branch, otherwise the code cannot be submitted. git pull Update the local master code;
        merge the changes submitted in the my cache to the local master branch, git merge my. (At this point, the changes have been merged with the local master);
        finally submit the code to the remote master, git push.
        (Suggestion: You can delete the my branch after submitting the ten thousand code, and recreate a my branch, because the version of the my branch and the master branch are different at this time, if you do not delete it, you need to delete the master branch
        The code above is merged and updated to the my branch. The lazy operation at this time is to delete my first and create it, so that the code of the my branch and the master branch is a unified version.
        git checkout -d my delete my branch; git checkout -b my new my branch)

 

 


 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325967721&siteId=291194637