Local project git steps

Copyright statement: This article is an original article by the blogger and follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement when reprinting.
Link to this article: https://blog.csdn.net/jyf_568/article/details/117544765

  1. First enter the project folder and use the command git init to turn this directory into a warehouse that can be managed by git.

    git init

  2. To add the file to the repository, use the command git add . to add it to the staging area. Don’t forget the decimal point “.” at the end, which means to add all the files in the folder.

    git add .

  3. Use the command git commit to tell Git to submit the file to the warehouse. Submission instructions are enclosed in quotation marks

    git commit -m ‘first commit’

  4. Link to remote library

    git remote add origin your remote library address. For example: git remote add origin https://github.com/cade8800/ionic-demo.git

  5. Create a new local branch:

    git checkout -b qunar_yuzhan_star

  6. Get the remote library and merge it with the local synchronization (this step must be done if the remote library is not empty, otherwise subsequent submissions will fail)

    git pull --rebase origin qunar_yuzhan_star

  7. To push the contents of the local library to the remote, use the git push command, which actually pushes the current branch qunar_yuzhan_star to the remote. After executing this command, you will be asked to enter your username and password. Once the verification is passed, the upload will begin.

    git push -u origin qunar_yuzhan_star

Attachment:
Delete the remote branch: git push origin --delete qunar_yuzhan_star

Guess you like

Origin blog.csdn.net/Peanut31434331/article/details/124741459