Git常用操作

常见的push/pull/commit等不说,记录一下自己用到的,但是又不是那么常见的操作

添加远程仓库

git remote add origin git@github.com:xxx/xxx.git

这里origin是添加的远程仓的remote别名,后面跟着的就是远程仓库的地址啦

添加了remote以后就可以用如下指令向该remote推送

git push origin master

origin代表刚刚添加的remote别名,master为本地需要推送的分支名称。

有时候会增加“-u”参数,代表本地的master分支自动track这个origin,以后在master上执行pull/push时,无需指定remote,就会以origin作为默认参数了

原文地址:https://www.cnblogs.com/mosakashaka/p/12608104.html