Steps for git company to collaboratively develop and submit code and update code

Before performing the git operation, you need to install the git tool git bash, which can be downloaded from the official website: https://git-scm.com/downloads
Assuming that the remote warehouse project now has two branches, one master (for version release, generally not used for submission) code), a test, now we clone the test branch to the local
first create a new branch locally for our own development, switch to the project directory (with the equivalent directory of the hidden folder .git), right click --> Git Bash Here, for example, I create a new branch wlc, git create a new branch and switch commands: git checkout -b wlc
Now I develop on my local wlc branch and write a lot of code (here, the little friends should pay attention not to modify other people's code, what is needed for their own development, create a new class or method, otherwise it will be There are a lot of unnecessary troubles), and now want to submit the code to the remote repository

  1. git status: First check the status of your current code and what has been modified
  2. git add .: Add your own modified code to the buffer area
  3. git commit -m "xxx": Add a description of the submission here xxx, just write something to explain what is submitted
  4. git fetch: Pull the remote repository code but not update it
  5. git checkout test: switch to the test branch, consistent with the remote warehouse
  6. git pull: Update the code first from the remote repository
  7. git merge wlc: Merge your new development branch wlc to the remote branch test. There may be conflicts here, so you need to resolve the conflict. You can consult your colleagues on how to solve the problem. It is the vi editor, which allows you to enter the description of the merge. You can enter the following directly without writing it : wq Note that there is a colon:, and then go to step 8)
  8. git push: Submit the local code code to the remote warehouse

If your local code has not changed, and you want to update the code written by others, you can directlygit checkout test --> git fetch --> git pull

Guess you like

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