新建仓库:git init
拷贝远程仓库到本地:git clone https://github.com/wispyoureyes/myblog.git(远程仓库地址)
本地仓库连接远程仓库:git remote add origin https://github.com/wispyoureyes/myblog.git(远程仓库地址)
将工作区文件改动添加到本地暂存区:git add < file > 将工作区所有改动添加到暂存区:git add .
第一次提交本地代码到远程master:git push -u origin master(之后都用git push)
新建分支:git branch new_branch 新建分支并切换到新分支上: git checkout -b new_brnach
删除远程分支(删除master前需要先将主分支设置为其他分支):git push -delete origin master 删除本地分支: git branch -d master
查看本地分支:git branch 查看包括远程分支的所有分支:git branch -a
回滚历史版本到新分支上:git branch new_branch HEAD(SHA)
新闻热点
疑难解答