1、登陆github,新建一个远程仓库(没有github就新建一个帐号)
1)创建新仓库入口在个人主页


2、打开mac终端
1)cd 到需要上传代码的根目录。

2)初始化git:git init

这里提下两个删除命令:rm xxx.xx 删除文件(xxx.xx为文件名字);rm -rf xxx 删除文件夹
3)添加文件到本地仓库:git add .( .为添加整个文件夹,也可以换成某个文件)
4)写更新纪录:git commit -m "xxx"

5)链接远程仓库(git仓库):git remote add origin https://github.com/xxx(xxx为你的地址)看我下面框出来的地址


6)执行更新操作:git pull origin master,再执行提交操作:git push origin master。注意:如果是第一次提交的话,不需要更新,直接提交:git push -f origin master
7)等待一小会会跳到这个页面问你合并分支的理由

8)按shift+q,再输入q!即可跳回原来的界面
9)最后一步上传:git push origin master


如果在pull的时候遇到这种情况:warning: no common commits。那可能就是你的代码不是最新的。先同步仓库的代码,不如REMDME.md文件没同步进来
git pull --rebase origin master
打tag
1、git查看tag命令:git tag
2、创建Tag直接加入名字就好了,格式:git tag 名字 -m 注释
3、将本地Tag推送到远程Tag上
命令:git push origin tag名(上面自己取得名字)
如:
git tag 1.0.0
git push origin tag 1.0.0
网友评论