Use git to manage common operations of projects

Hits: 0

git manage projects

Scenario: A development team starts to jointly develop a new project. Each person is responsible for different functional modules. The project code is submitted and managed through the git repository. When the project is halfway through, a new colleague joins the project development. “The operation is as follows:

1 ). Create a remote repository
    Created on github

2 ). Create a local repository
    a. Configure.gitignore           // Configure files that do not need to be uploaded 
    b. git init              // Initialize the project 
    c. git add .             // Add the project to the staging area 
    d. git commit -m "init"     // Commit

3 ). Push the local repository to the remote repository
    git remote add origin url   // Associate the remote warehouse url to the remote warehouse address 
    git push origin master      // Push the local warehouse to the remote warehouse

4 ). Create dev branch locally and push to remote
    git checkout -b dev      // Create a new branch and switch to the new branch dev 
    git push origin dev      // Push the local project to the new branch dev

5 ). If there are changes locally, perform the following add, submit, and push operations again
    git add .                // Add the modified code to the staging area 
    git commit -m "xxx"     // Submit 
    git push origin dev      // Push to the new branch

6 ). New colleague: clone repository
    git clone url    // The new colleague clones the project code 
    git checkout -b dev origin/dev   // The new colleague creates a new branch and switches to a branch 
    git pull origin dev  // After writing the code, push it to a branch

7 ). If remote modification, perform push operation
    git pull origin dev

You may also like...

Leave a Reply

Your email address will not be published.