关于Git的一些总结【自用】

创建ssh key
ssh-keygen -t rsa -C "邮箱"

cat is_rsa.pub  获取public key

ssh -T git@github.com  测试是否与github连接

添加远程仓库

将本地仓库与远程github仓库关联起来
git remote add origin git@github.com:Liuyt61/Liuyt_muke.git

git pull origin master --allow-unrelated-histories

git push -u origin master

克隆仓库
git clone git@github.com:lyt609635570/demo.git

标签管理:
查看所有标签  git tag
创建标签  git tag name
指定提交信息  git tag -a name -m "comment"
删除标签 git tag -d name
标签发布 git push origin name

分支管理
git branch feature_x  创建一个feature_x分支

git branch  查看当前分支
显示:feature_x
     *master
     * 表示当前在哪个分支上

git checkout feature_x  切换分支
将feature_x分支合并到master分支上,先切换到master分支,然后  git merge feature_x

  • 工作流: 工作区->暂存区->版本库
  • 初始化   git init ->git add -> git commit
  • 远程仓库  git  remote add -> git pull -> git push -> git clone
  • 分支管理 git branch -> git checkout -> git merge
  • 标签管理  git tag -> git push

 

原文地址:https://www.cnblogs.com/Liuyt-61/p/10246115.html