git init # 初始配置,创建本地仓库
git add . # 添加当前目录下所有文件到本地仓库
git branch [branchname] # 创建新分支
git branch -b [branchname] # 创建并切换到新分支
git branch -d [branchname] # 删除分支
git config --global user.name
git config --global user.email
git checkout [branchname] # 切换分支
git commit -m “Initial Commit” # 初始提交
git remote add origin [github-repo-url] # 关联远程仓库
git remote -v # 查看已关联的远程仓库链接
git remote remove [branchname] # 删除已关联的远程仓库链接
git push -u origin main # 推送本地main分支到远程仓库
Git常用操作命令
最新推荐文章于 2024-07-08 11:02:49 发布