常用git命令(包含从一个远程仓库拉取更新同步到另外一个远程仓库)

  • Post author:
  • Post category:其他


创建分支

git branch test

把分支推到远程分支

git push origin test:master         // 提交本地test分支 作为 远程的master分支

git push origin test:test              // 提交本地test分支作为远程的test分支

查看本地分支

git branch

切换分支到test

git checkout test

切换到之前提交的log(commit 69ad395df31468bdc062ab7b4c623cf40c6df4ce)上

git checkout 69ad395df

删除本地分支test

git branch -d test

删除远程分支

git branch -r -d origin/branch-name

git push origin :branch-name

git remote remove br-name

获取远程分支信息

git remote show (remote-br)

将当前master中的内容提交到另外一个远程分支

git remote add branch1 https://xxx.git

git fetch branch1

git merge branch1/master

git push branch1 master



从一个远程仓库拉取更新同步到另外一个远程仓库。一个典型应用场景是,我fork了一个RTT到我的git下,然后从我的远程仓库中g



版权声明:本文为caogos原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。