github三步走(init;add . ;commit -m "提交说明")

掌握以下几点就基本能满足你平时使用了。
按这个顺序来
1.git安装,已经好了,略

-到这里本地代码推送到远程已经结束了

2.git本地命令操作
-shift+右键
-git init:初始化git环境
-新建一个“我的文档”
-git status 查看当前git工作空间文件状态 "346210221347232204346226207346241243.txt==>我的文档
-git add . 表示将所有的文件添加到git本地仓库中
-git status 再次查看工作空间状态
-git commit -m "提交我的文档" (提交本次更新内容)
-到这里本地的代码都已经提交好了,接下来我们准备好远程仓库,目的是来存放我们本地的代码


3.本地git项目发布到github上
-git remote add origin https://github.com/Kingserch/gitdemo.git 将本地的项目与仓库相关联
-git pull origin master 将远程仓库的代码拉取到本地
-git merge origin/master 将本地的分支与远程分支进行合并
fatal: refusing to merge unrelated histories(这里报错了,则加上这句命令allow-unrelated-histories)
-git push origin master 将本地代码推送到远程github上面,现在出现了密码输入框
-若出现这个错误: ! [rejected] master -> master (non-fast-forward)
则执行 git push --force origin master 替换原先的git push -u origin master

再举个栗子,你在此修改文件和新增文件,然后同步到github上面,这个我不做笔记了,你看清楚了.结束。
更新和添加就是循环
git add . 更新数据之后,进行添加
git status 然后查看数据状态
git push origin master推送到远程仓库


4.github项目克隆到本地,克隆其他人的项目为例

随便找一个仓库地址:https://github.com/kakaluote444/LOLGame.git(这边是你想克隆的仓库地址)克隆本地,并且修改源码

-首先你需要fork这个项目才有权限修改代码,所以先fork一下,fork完后这个项目就是归属于你了
-执行 git clone https://github.com/Kingserch/LOLGame.git(克隆的是ssh连接)

与人善言,暖于布锦,伤人之言,深于矛戟
原文地址:https://www.cnblogs.com/liang-io/p/9256941.html