加载中...

Git

配置用户信息 (打开Git Bash)

1)设置用户信息

git config --global user.name "Hyman"
git config --global user.email "123@qq.com"

2)查看配置信息

git config --global user.name
git config --global user.email

3)忽略文件 .gitignore

# 隐藏public文件
public/  

# 隐藏首目录下的public目录下的所有,但不隐藏index文件
/public/* 
!/public/index


git常用命令

| `本地仓库操作` |
| git init  | 生成.git     |
| git status | 查看本地库状态  |
| git add . | 添加到暂存区 |
| git commit -m "日志信息" 文件名 | 提交到本地库   |
| git reflog   | 查看历史记录   |  
| git reset --hard 编码  | 版本穿梭   |

| `分支操作` |
| git branch 分支名  | 创建分支   |
| git branch -v  | 看有多少分支   |
| git checkout 分支名  | 切换分支   |
| git merge 分支名  | 合并分支(先切换到master上)   |

| `代码仓库操作` |
| git clone https://github...  | 克隆仓库上的目录   |
| git remote -v  | 查看远程库有没有 别名   |
| git remote add 别名 https://github...  | 新建别名   |
| git remote rm name  |  删除远程仓库别名 |
| git remote rename old_name new_name  | 修改仓库名别名 |

| git pull 别名 master  | 拉取仓库的master分支到本地   |
| git push 别名 master  | 推送master分支到仓库   |

图解 远程仓库流程

解决gitbash乱码

posted @ 2023-06-13 17:44  1502god  阅读(11)  评论(0)    收藏  举报
-->