git 命令使用

本文详细介绍了在Windows环境下使用PowerShell生成SSH密钥,并通过实例演示了如何从Git服务器克隆项目,查看和管理远程及本地分支,以及创建、删除、推送和同步Git标签。这些步骤对于日常Git工作流程至关重要。
摘要由CSDN通过智能技术生成

生成 git 的key:

利用windows PowerShell 命令生成key:

ssh-keygen -t ed25519 -C "your_email@example.com"

1、从git上down项目:

git clone git服务器地址

如:git clone git@codeup.aliyun.com:

注:会有提示,一路yes——ok

remote address

查看远程分支
git branch -v

查看所有分支
git branch -a

创建本地分支 
git branch local_branch_name 

切换本地分支 
git checkout  local_branch_name  

创建并切换到本地分支
git checkout -b  local_branch_name  

删除本地分支
git b

tag

# 查看
git tag
git show <tag_name>

# 创建
git tag -a v201909 -m "这里是说明"
git tag v201909

# 删除
git tag -d v201909

# 以前的commit 打标签
git tag -a v201903 9fcec02

# 推送
git push orgin <tag_name>
git push origin --tags

# 同步所有tag
git fetch

Branch

查看远程分支
git branch -v

查看所有分支
git branch -a

创建本地分支 
git branch local_branch_name 

切换本地分支 
git checkout  local_branch_name  

创建并切换到本地分支
git checkout -b  local_branch_name  

删除本地分支
git branch -d  local_branch_name  

推送本地分支到远程
git push origin <local_branch_name>:<remote_branch_name>

删除远程分支
git push origin :<remote_branch_name>

克隆远程指定分支
git clone -b <branch_name> --single-branch <repo_name>
git clone -b dashed_3.0 --single-branch http://192.168.10.90/server/transfer.git

迁出远程分支到本地
git checkout -b <local_branch_name> <remote_branch_name>
git checkout -b dashed_3.0 origin/dashed_3.0

合并指定分支到本地当前分支, local_branch_name2合并到local_branch_name1
git checkout <local_branch_name1>
git merge <local_branch_name2>

拉取远端origin/master分支并合并到当前分支
git pull origin master

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值