git 易忘操作记录

147 阅读1分钟

创建本地分支,并关联远端对应分支

说明:

本地只有master分支,想要在本地创建develop分支,并和远端的develop关联

git checkout -b develop origin/develop

换行符报错

git 提示换行符错误时候,可以设置git 解决一下这个问题

但是已经 clone 完的项目不行的,新 clone 的项目才行

git config --global core.autocrlf false

git config --global core.ignorecase false

本地项目,关联远端仓库

初始化

git init

然后关联远程仓库。你需要存在一个远程仓库,名字随意,然后执行下面的命令(去掉中括号)就可以关联到该仓库。

git remote add origin https://github.com/xienb/NPC.git

提交

git add .
git commit -m '初始化项目'
git push

git config 配置用户信息

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

#  --global 可加可不加,加了的话在这个电脑上的项目配置一次以后就不用配置了,其他的项目就不用配置了
#  不加的话本次配置只对当前的项目有效,其他的项目还要配置一次

git config --list 	# 获取配置信息