# git-demo **Repository Path**: luotybest/git-demo ## Basic Information - **Project Name**: git-demo - **Description**: git学习 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-11-10 - **Last Updated**: 2021-11-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 入职流程(环境搭建) 1. node安装 -> npm : node中文网: http://nodejs.cn/download/current/ brew 安装node:https://www.jianshu.com/p/20ea93641bda 2. git 安装 -> window安装:https://git-scm.com/ mac:https://www.jianshu.com/p/7edb6b838a2e 3. vs code安装 -> 官网: https://code.visualstudio.com/ (很慢) 4. 钉钉:云盘 ## .gitignore git忽略配置文件 ## git 常用命令 1. 初始化git本地仓库 ```shell git init -q ``` 2. 查看项目文件状态 ```shell git status # untracked files --> 未跟踪 # Changes not staged for commit --> 已暂存 -- 已修改 ``` 3. 跟踪文件 git add :: 将文件添加到暂存区 ```shell git add 文件名 # 跟踪单个文件 # 或者 git add . 跟踪所有文件 ``` 4. 将暂存区的文件添加到本地仓库 ```shell git commit ``` 5. 查看是否有远程仓库 `git remote -v` 添加远程仓库 `git remote add 别名 仓库地址` 移除远程仓库: `git remote rm 远程仓库简称(别名)` 6. 查看git日志 ```shell git log ``` 7. 将本地代码推送到 远程仓库 `git push` 8. 从远程仓库拉取最新的代码 `git pull` `git fetch` 9. 设置git账户邮箱 ```bash # 设置用户名 git config --local (--global) user.name gitee用户名{} # 设置邮箱 git config --local (--global) user.email gitee用户名{} ``` 100. 练习git git add git commit -m ## 总结 - `git init -q`: 初始化本地仓库 - `git remote add origin git地址` -> 添加远程仓库 - `git status` -> git add . -> git commit -m "说明" - **重中之重**: 推送代码之前先拉取代码,防止代码冲突。`git pull` -> 拉取远程代码 - `git push` -> 推送代码到远程仓库 - 分支管理 --> 明天再说.