Git官网下载:https://git-scm.com/download
选择win系统,下载。然后选择安装路径,一路next。安装成功后 打开cmd 输入 git --version
配置信息
设置user.name
git config --global user.name "your name"
设置user.email
git config --global user.email "your email"
设置CRLF配置
git config --global core.autocrlf true
自己常用的一些Git命令
- 显示command的help
git help <command>
- 将工作文件修改提交到本地暂存区
git add <file>
- 提交修改内容
git commit "message"
- 将本地主分支推到远程
git push -u <remoteName> <localBrachName>
- 克隆远程仓库
git clone <url>
- 初始化仓库
git init
- 创建仓库
git remote add <remoteName> <url>
- 删除远程仓库
git remote rm <name>
- 修改远程主机名
git remote rename <remoteName> <newRemoteName>
- 拉取远程仓库
git pull <remoteName> <localBrachName>
- 修改远程仓库
git remote set-url --push <remoteName> <newUrl>
- 获取远程仓库的更新
git fetch <remoteName>
- 获取远程仓库特定分支的更新
git fetch <remoteName> <brachName>