Git连接GitHub并上传文件

版权声明:本文为博主在学习过程给自己记录,也让给朋友们少走点弯路。手动码字,义务整理,不喜勿喷。 https://blog.csdn.net/pratise/article/details/88784132

本地添加远程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] //切换分支

猜你喜欢

转载自blog.csdn.net/pratise/article/details/88784132