配置用户名和邮箱地址
git config --global user.name "xxxxx"
git config --global user.email "xxxxxx@xx.com
生成ssh key
ssh-keygen -t rsa -C "youremail@xx.com"
初始化仓库
git init
将文件添加到缓存
git add hello.txt
git add .
查看在你上次提交之后是否有修改
git status
将缓存区内容添加到仓库中
git commit -m "add hello.txt"
-m :为操作添加注释
连接远程仓库
git remote add origin "URL"
git remote add origin "git@github.com:GoAllTheWay/Test.git"
删除已连的远程
git remote rm origin
查看已连接的远程库信息
git remote -v
从远程获取最新版本并合并
到本地
git pull origin master
将本地的master分支推送到origin主机
git push origin master
连接GitHub
ssh -T git@github.com
拷贝一个 Git 仓库到本地
git clone "URL"
get clone "git@github.com:GoAllTheWayWpt/Test.git"
创建分支命令
git branch (branchname)
切换分支命令
git checkout (branchname)
合并分支命令
git merge