美文网首页
Git 常用命令

Git 常用命令

作者: realgods | 来源:发表于2017-03-16 01:19 被阅读0次

全局配置

  • 设置用户名 git config --global user.name "YourName"
  • 设置用户邮箱 git config --global user.email "YourEmail@Sth.com"

创建空的远程仓库

git clone RemoteRepoSSHAddress
cd YourFolder
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

用本地目录创建远程仓库

cd YourFolder
git init
git remote add origin RemoteRepoSSHAddress
git add .
git commit
git push -u origin master

分支命令

  • 克隆远程分支 git clone -b BranchName RemoteRepoSSHAddress
  • 查看本地和远程分支 git branch -va
  • 查看远程仓库指向 git remote -v
  • 重命名本地分支名 git branch -m OldName NewName
  • 切换远程仓库 git remote set-url origin NewRemoteRepoSSHAddress

相关文章

网友评论

      本文标题:Git 常用命令

      本文链接:https://www.haomeiwen.com/subject/jbcdnttx.html