本地代码推送到github仓库

本地代码推送到github仓库步骤:
1、git 初始化
cd 到需要提交的项目目录下,执行git init

2、添加文件到缓存区
git add filename // 添加文件到缓存区,可单一文件或全部文件

3、缓存区提交
git commit -m “备注”

4、远程仓库关联
git remote add origin 仓库地址

4、提交之前先pull下代码
git pull origin master --allow-unrelated-histories

5、提交至仓库master分支
git push origin master

6、查看本地分支
git branch

7、查看本地/远程分支
git branch -a

8、切换分支
git checkout branch

发布了143 篇原创文章 · 获赞 13 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/TreeShu321/article/details/103447128
今日推荐