git基本使用

输入仓库名

每个仓库都会对应一个地址。

这里可以设置仓库成员

git常用命令

1. git全局设置

安装git后首要事情,就是设置用户名和email地址

设置用户信息

git config --global user.name "用户名"
git config --global user.email "邮箱"

查看配置信息

git config --list

2.获取git仓库

获取本地仓库

git init

克隆远程仓库

git clone 仓库url地址

3.本地仓库操作

git add 文件名
git reset 操作id
git commit -m "操作注释" 文件名

4.远程仓库操作

git remote -v 查看远程仓库详情信息(没关联就啥都不显示)
git remote add <shortname> <url> 添加新的远程仓库,同时指定一个可以引用的简写(约定是origin)
git push remote-name branch-name remote-name就是你连接是自己取得shortname
git push remote-name branch-name 拉取分支内容

5.分支操作

查看分支

git branch 列出所有分支
git branch -r 列出所有远程分支
git branch -a 列出所有本地分支和远程分支

创建分支

git branch name

切换分支

git checkout name

合并分支

git merge name

6.标签操作

git tag 列出已有标签
git tag name 创建标签
git push shortname name 推送标签到远程仓库
git checkout -b branch name 检出标签

相关推荐
BIBI20499 小时前
换 Git 托管平台怎么做?基于 TortoiseGit 的跨平台迁移教程
windows·git·tortoisegit·问题解决·版本控制·最佳实践
echome88816 小时前
Git 日常救急:撤销提交、找回误删文件和解决冲突
git·版本控制
赵民勇21 小时前
Git命令详解
git
不老刘2 天前
Antigravity 的 New Worktree 模式:给 AI 代理一个安全的“平行工位”
人工智能·git·ai编程·antigravity
光谱SpectrAI2 天前
Windows 也中招:Git Bash 和 Node 仍信任泄露的 eMudhra 证书
git
YIN_尹2 天前
【git原理与使用】git初识与安装
大数据·git·elasticsearch
Leo_Mr2 天前
Vue3 项目配置 Git 提交规范(企业通用方案:husky + commitlint + cz-git + lint-staged)
git
jyOverQ2 天前
Git rebase 和 merge 有什么区别?什么时候该用哪个?
git
晗夜未央2 天前
跨仓库 Skill 换台电脑就失效?用 Git remote 校验项目
人工智能·git·python
Lsetea2 天前
Git访问HTTPS证书不受信任:用URL级sslCAInfo限定私有CA范围
git·https·开发工具·ssl证书·ca证书