[日常技能] Git连接GitHub并上传文件

本地添加远程git仓库

git remote add hello https://github.com/Pretice/Hello-world.git

查看所有分支

git branch -a
/*dev
  master
  test2
  remotes/hello/dev
  remotes/hello/devT
  remotes/hello/master
  remotes/hello/tes
  remotes/hello/test2
  remotes/origin/master
*/

建立本地分支和远程分支联系

git branch --set-upstream-to=hello/test2 test2

更新远程代码到本地

git pull
//Already up to date.//已经是最新的了

查看分支状态

git status
//*On branch test2 //目前分支为test2
Your branch is up to date with 'hello/test2'. //你的分支是最新的'hello/test2'
*/
nothing to commit, working tree clean //没有需要commit的文件

在本地添加新文件进行上传测试

git add -A //添加所有文件
git commit -m "测试提交注释"
git push //上传到远程github仓库
git pull //获取最新的文件

git remote //查看远程的仓库
git branch -a //查看所有的分支
git checkout [branch] //切换分支
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值