如果是第一次使用git,需要使用git config配置提交者信息,因为以后需要多人开发时,可以区分不同的修改者
git config --global user.name "自己的用记名"
git config --global user.email "自己的正确的邮箱"
查看远程仓库名称
git remote -v
查看配置信息
git config --list
使用Git下载指定分支命令为
git clone -b 分支名 链接
查看本地分支
git branch
查看远程分支
git branch -a
添加分支,***分支名字
git branch ***
删除分支
git branch -D ***
提交代码到指定分支
git push origin ***
git常用命令
克隆代码
git clone 链接
上传代码
git add .
git commit -m "备注"
git push
更新代码
git pull
清理本地已删除的远程分支:
git fetch --prune
删除的远程分支的名称。例如,如果你要删除 feature-branch,命令将是:
git push origin --delete feature-branch
记住账户密码,不用每次都输入:
git config --global credential.helper store
更改远程仓库地址
git remote set-url origin 新的仓库地址