Skip to main content

GitHub本地常用命令

  • 设置时区

git config --global log.data local

  • push到远程仓库时记住密码

git config --global credential.helper store

协同

  • 创建分支dev并切换至该分支

git switch -c dev

  • 查看当前分支

git branch

  • 切换到分支dev

git swtich dev

  • 删除分支dev

git branch -d dev

  • 合并分支dev到当前分支

git merge dev

  • 添加远程仓库,以Github为例

git remote add <name> <url>

添加一个名为therainisme的远程仓库

git remote add therainisme https://github.com/Therainisme/HelloKexie.git

拉取代码master是远程仓库的分支

git pull therainisme master

推送代码 如果加了-u,意思是远程仓库没有这个分支的话会自动创建一个

git push -u therainisme master