基本使用Git

创建仓库

git init 初始化 当前目录
git init newrepo newrepo目录下初始化

远程仓库操作

clone 拷贝远程仓库

git clone <repo>
例: git clone https://github.com/rchangl/hexo-autotitle.git

关联远程仓库

git remote add origin 地址(设置远程remote地址);
例: git remote add hexo-autotitle https://github.com/rchangl/hexo-autotitle.git

删除远程仓库

1
git remote rm name  # 删除远程仓库

修改 仓库名

1
git remote rename old_name new_name  # 修改仓库名

查看远程仓库信息

git remote 查看远程仓库,列出名字
--verbose -v 列出对应的仓库地址

git remote show [remote-name] 查看具体的某个远程仓库信息

分支管理

git branch 列出分支

git branch -m <oldbranch> <newbranch> 重命名分支
-M 强制重命名