Set up a repository on Github
2. Create a. Gitignore file in the project root directory
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
/.idea
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
Copy the code
Initialize Git
git init
Copy the code
4. Add existing files to the staging area
git add .
Copy the code
Commit to the version area
Git commit -mCopy the code
6. Associate the local warehouse with the remote warehouse
git remote add origin https://github.com/xxx.git
Copy the code
7. Push local branches to remote locations
git push origin master
Copy the code
Create a new branch (the original branch needs to be saved and committed before creation)
Git checkout -b dev # git origin devCopy the code
View all branches
git branch -a
Copy the code
Switch branch
Git Checkout branch nameCopy the code
Obtain remote branches by cloning
Git clone -b dev origin/devCopy the code