1. Create a new warehouse;
2. Git global settings:
git config --global user.name "Icy"
git config --global user.email "[email protected]"
3. Existing warehouse folder:
//初始化
git init
//查看状态
git status
//提交所有文件
git add .
git commit -m "init"
//查看状态
git status
//将本地代码提交到 git 仓库
git remote add origin https://gitee.com/Icyya/aaa.git
git push -u origin master
4. Open the project folder Step 1: Check the project status
git status
5. Create a new branch and merge it into the main branch after completion:
git checkout -b 分支名
6. View all branches:
git branch
7. Temporarily save to local:
git add .
git stash save "init"
git stash list
git stash apply stash@{0}
git status
8. Submit the local branch to the remote:
git push origin component:component
9. Pull the remote branch to the local:
git pull origin 分支名
10. Other common commands:
更新远程分支列表
git remote update origin --prune
查看所有分支
git branch -a
删除远程分支Chapater6
git push origin --delete Chapater6
删除本地分支 Chapater6
git branch -d Chapater6
创建分支:git branch <name>
切换分支:git checkout <name>
创建+切换分支:git checkout -b <name>
合并某分支到当前分支:git merge <name>