Git common process

Git common process

  1. For new projects, initialize your project in your project directory. If it is (existing project) subsequent function development/code change, please ignore this step .

    cd <项目目录>
    git init
    
  2. Checkout (checkout) a new feature or bug fix (feature/bug-fix) branch.

    git checkout -b <分支名称>
    
  3. Added code changes.

    git add
    git commit -a
    

    git commit -aAn editor will be launched independently to edit your description information, so that you can focus on writing these notes.

  4. Keep in sync with the remote (develop branch) so that (the local develop branch) gets the latest changes.

    git checkout develop
    git pull
    

    Keeping updated gives you a chance to resolve conflicts on your machine when you do a (later) rebase. This is better than (doing the next rebase operation without syncing the update and) making a merge request that conflicts with the remote repository.

  5. (Switch to feature branch and) update your feature branch by interactively rebasing the latest code commit from your develop branch.

    git checkout <branchname>
    git rebase -i --autosquash develop
    

    You can --autosquashsquash all commits into a single commit with . No one wants (sees) developa single feature development in a branch taking up so much commit history.

  6. Skip this step if there are no conflicts, if you have conflicts, you need to resolve them and continue with the rebase operation.

    git add <file1> <file2> ...
    git rebase --continue
    
  7. Push your (feature) branch. Rebasing changes the commit history, so you must use -fforce push to remote (feature) branch. If other people are co-developing with you on that branch, use a less destructive --force-with-leaseparameter.

    git push -f
    

    When you rebase, you change the commit history of the feature branch. This causes Git to reject normal ones git push. Then, you can only use -fthe or --forceparameter.

  8. Submit a pull request.

  9. Pull Requests are accepted, merged and closed by colleagues responsible for code reviews.

  10. Remember to delete your local branch if you are done developing.

    git branch -d <分支>
    

Supongo que te gusta

Origin blog.csdn.net/qq_51173321/article/details/129216499
Recomendado
Clasificación