git学习使用
uwupu 啦啦啦啦啦

Git

提交记录/历史

1
git log

Remote仓库

添加远程仓库

1
2
git remote add <远程地址代号> https://
git remote add origin https://github.com/xxx

代号:在本地为远端仓库的命名。

推送代码到指定远端仓库

1
2
git push -u <远程地址代号> <分支>
git push -u origin main

分支

创建分支:git checkout -b <NAME> / git branch <NAME>。^注释:checkout会切换到创建的分支,branch只创建不切换。一般用前者。^

删除分支:git branch -d <NAME>

查看分支:

  • 本地分支:git branch
  • 远程分支:git branch -r
  • 所有分支:git branch -a

切换分支:git checkout <NAME>

合并分支:git merge <NAME> 将NAME分支合并到当前分支。

拉取指定分支:git pull <远程地址代号> <BRANCH_NAME>

 评论